Skip to content

Commit e2fe951

Browse files
committed
Fix compilation errors in Bullet 2.84/2.85
1 parent 955ca0d commit e2fe951

File tree

3 files changed

+42
-8
lines changed

3 files changed

+42
-8
lines changed

doc/ReleaseNotes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ This issue fixes several bugs that were still found in 1.9.2.
4343
* Fix exception when creating intervals before ShowBase is started
4444
* Fix rare X11 .ico cursor bug; also now supports PNG-compressed icons
4545
* Add keyword argument support to make() methods such as Shader.make()
46+
* Fix compilation errors with Bullet 2.84
4647

4748
------------------------ RELEASE 1.9.2 ------------------------
4849

panda/src/bullet/bulletCharacterControllerNode.cxx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
#include "bulletCharacterControllerNode.h"
1616

17+
#if BT_BULLET_VERSION >= 285
18+
static const btVector3 up_vectors[3] = {btVector3(1.0f, 0.0f, 0.0f), btVector3(0.0f, 1.0f, 0.0f), btVector3(0.0f, 0.0f, 1.0f)};
19+
#endif
20+
1721
TypeHandle BulletCharacterControllerNode::_type_handle;
1822

1923
////////////////////////////////////////////////////////////////////
@@ -57,8 +61,13 @@ BulletCharacterControllerNode(BulletShape *shape, PN_stdfloat step_height, const
5761
_angular_movement = 0.0f;
5862

5963
// Character controller
64+
#if BT_BULLET_VERSION >= 285
65+
_character = new btKinematicCharacterController(_ghost, convex, step_height, up_vectors[_up]);
66+
_character->setGravity(up_vectors[_up] * -(btScalar)9.81f);
67+
#else
6068
_character = new btKinematicCharacterController(_ghost, convex, step_height, _up);
6169
_character->setGravity((btScalar)9.81f);
70+
#endif
6271

6372
// Retain a pointer to the shape
6473
_shape = shape;
@@ -301,8 +310,11 @@ get_max_slope() const {
301310
////////////////////////////////////////////////////////////////////
302311
PN_stdfloat BulletCharacterControllerNode::
303312
get_gravity() const {
304-
313+
#if BT_BULLET_VERSION >= 285
314+
return -(PN_stdfloat)_character->getGravity()[_up];
315+
#else
305316
return (PN_stdfloat)_character->getGravity();
317+
#endif
306318
}
307319

308320
////////////////////////////////////////////////////////////////////
@@ -311,8 +323,11 @@ get_gravity() const {
311323
////////////////////////////////////////////////////////////////////
312324
void BulletCharacterControllerNode::
313325
set_gravity(PN_stdfloat gravity) {
314-
326+
#if BT_BULLET_VERSION >= 285
327+
_character->setGravity(up_vectors[_up] * -(btScalar)gravity);
328+
#else
315329
_character->setGravity((btScalar)gravity);
330+
#endif
316331
}
317332

318333

panda/src/bullet/bulletManifoldPoint.I

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,15 @@ INLINE BulletManifoldPoint::
2929
////////////////////////////////////////////////////////////////////
3030
INLINE void BulletManifoldPoint::
3131
set_lateral_friction_initialized(bool value) {
32-
32+
#if BT_BULLET_VERSION >= 285
33+
if (value) {
34+
_pt.m_contactPointFlags |= BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED;
35+
} else {
36+
_pt.m_contactPointFlags &= ~BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED;
37+
}
38+
#else
3339
_pt.m_lateralFrictionInitialized = value;
40+
#endif
3441
}
3542

3643
////////////////////////////////////////////////////////////////////
@@ -40,8 +47,11 @@ set_lateral_friction_initialized(bool value) {
4047
////////////////////////////////////////////////////////////////////
4148
INLINE bool BulletManifoldPoint::
4249
get_lateral_friction_initialized() const {
43-
50+
#if BT_BULLET_VERSION >= 285
51+
return (_pt.m_contactPointFlags & BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED) != 0;
52+
#else
4453
return _pt.m_lateralFrictionInitialized;
54+
#endif
4555
}
4656

4757
////////////////////////////////////////////////////////////////////
@@ -238,8 +248,9 @@ get_applied_impulse_lateral2() const {
238248
////////////////////////////////////////////////////////////////////
239249
INLINE void BulletManifoldPoint::
240250
set_contact_cfm1(PN_stdfloat value) {
241-
251+
#if BT_BULLET_VERSION < 285
242252
_pt.m_contactCFM1 = (btScalar)value;
253+
#endif
243254
}
244255

245256
////////////////////////////////////////////////////////////////////
@@ -249,8 +260,11 @@ set_contact_cfm1(PN_stdfloat value) {
249260
////////////////////////////////////////////////////////////////////
250261
INLINE PN_stdfloat BulletManifoldPoint::
251262
get_contact_cfm1() const {
252-
263+
#if BT_BULLET_VERSION < 285
253264
return (PN_stdfloat)_pt.m_contactCFM1;
265+
#else
266+
return 0;
267+
#endif
254268
}
255269

256270
////////////////////////////////////////////////////////////////////
@@ -260,8 +274,9 @@ get_contact_cfm1() const {
260274
////////////////////////////////////////////////////////////////////
261275
INLINE void BulletManifoldPoint::
262276
set_contact_cfm2(PN_stdfloat value) {
263-
277+
#if BT_BULLET_VERSION < 285
264278
_pt.m_contactCFM2 = (btScalar)value;
279+
#endif
265280
}
266281

267282
////////////////////////////////////////////////////////////////////
@@ -271,7 +286,10 @@ set_contact_cfm2(PN_stdfloat value) {
271286
////////////////////////////////////////////////////////////////////
272287
INLINE PN_stdfloat BulletManifoldPoint::
273288
get_contact_cfm2() const {
274-
289+
#if BT_BULLET_VERSION < 285
275290
return (PN_stdfloat)_pt.m_contactCFM2;
291+
#else
292+
return 0;
293+
#endif
276294
}
277295

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy