diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index da8e24ae0f..88631b2244 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -43,6 +43,7 @@ This issue fixes several bugs that were still found in 1.9.2. * Fix exception when creating intervals before ShowBase is started * Fix rare X11 .ico cursor bug; also now supports PNG-compressed icons * Add keyword argument support to make() methods such as Shader.make() +* Fix compilation errors with Bullet 2.84 ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/panda/src/bullet/bulletCharacterControllerNode.cxx b/panda/src/bullet/bulletCharacterControllerNode.cxx index f0cb471e40..648b8a76e6 100644 --- a/panda/src/bullet/bulletCharacterControllerNode.cxx +++ b/panda/src/bullet/bulletCharacterControllerNode.cxx @@ -14,6 +14,10 @@ #include "bulletCharacterControllerNode.h" +#if BT_BULLET_VERSION >= 285 +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)}; +#endif + TypeHandle BulletCharacterControllerNode::_type_handle; //////////////////////////////////////////////////////////////////// @@ -57,8 +61,13 @@ BulletCharacterControllerNode(BulletShape *shape, PN_stdfloat step_height, const _angular_movement = 0.0f; // Character controller +#if BT_BULLET_VERSION >= 285 + _character = new btKinematicCharacterController(_ghost, convex, step_height, up_vectors[_up]); + _character->setGravity(up_vectors[_up] * -(btScalar)9.81f); +#else _character = new btKinematicCharacterController(_ghost, convex, step_height, _up); _character->setGravity((btScalar)9.81f); +#endif // Retain a pointer to the shape _shape = shape; @@ -301,8 +310,11 @@ get_max_slope() const { //////////////////////////////////////////////////////////////////// PN_stdfloat BulletCharacterControllerNode:: get_gravity() const { - +#if BT_BULLET_VERSION >= 285 + return -(PN_stdfloat)_character->getGravity()[_up]; +#else return (PN_stdfloat)_character->getGravity(); +#endif } //////////////////////////////////////////////////////////////////// @@ -311,8 +323,11 @@ get_gravity() const { //////////////////////////////////////////////////////////////////// void BulletCharacterControllerNode:: set_gravity(PN_stdfloat gravity) { - +#if BT_BULLET_VERSION >= 285 + _character->setGravity(up_vectors[_up] * -(btScalar)gravity); +#else _character->setGravity((btScalar)gravity); +#endif } diff --git a/panda/src/bullet/bulletManifoldPoint.I b/panda/src/bullet/bulletManifoldPoint.I index e99c2060ca..9ebfa6e1ec 100644 --- a/panda/src/bullet/bulletManifoldPoint.I +++ b/panda/src/bullet/bulletManifoldPoint.I @@ -29,8 +29,15 @@ INLINE BulletManifoldPoint:: //////////////////////////////////////////////////////////////////// INLINE void BulletManifoldPoint:: set_lateral_friction_initialized(bool value) { - +#if BT_BULLET_VERSION >= 285 + if (value) { + _pt.m_contactPointFlags |= BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED; + } else { + _pt.m_contactPointFlags &= ~BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED; + } +#else _pt.m_lateralFrictionInitialized = value; +#endif } //////////////////////////////////////////////////////////////////// @@ -40,8 +47,11 @@ set_lateral_friction_initialized(bool value) { //////////////////////////////////////////////////////////////////// INLINE bool BulletManifoldPoint:: get_lateral_friction_initialized() const { - +#if BT_BULLET_VERSION >= 285 + return (_pt.m_contactPointFlags & BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED) != 0; +#else return _pt.m_lateralFrictionInitialized; +#endif } //////////////////////////////////////////////////////////////////// @@ -238,8 +248,9 @@ get_applied_impulse_lateral2() const { //////////////////////////////////////////////////////////////////// INLINE void BulletManifoldPoint:: set_contact_cfm1(PN_stdfloat value) { - +#if BT_BULLET_VERSION < 285 _pt.m_contactCFM1 = (btScalar)value; +#endif } //////////////////////////////////////////////////////////////////// @@ -249,8 +260,11 @@ set_contact_cfm1(PN_stdfloat value) { //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BulletManifoldPoint:: get_contact_cfm1() const { - +#if BT_BULLET_VERSION < 285 return (PN_stdfloat)_pt.m_contactCFM1; +#else + return 0; +#endif } //////////////////////////////////////////////////////////////////// @@ -260,8 +274,9 @@ get_contact_cfm1() const { //////////////////////////////////////////////////////////////////// INLINE void BulletManifoldPoint:: set_contact_cfm2(PN_stdfloat value) { - +#if BT_BULLET_VERSION < 285 _pt.m_contactCFM2 = (btScalar)value; +#endif } //////////////////////////////////////////////////////////////////// @@ -271,7 +286,10 @@ set_contact_cfm2(PN_stdfloat value) { //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BulletManifoldPoint:: get_contact_cfm2() const { - +#if BT_BULLET_VERSION < 285 return (PN_stdfloat)_pt.m_contactCFM2; +#else + return 0; +#endif }