diff --git a/Demos/OpenGL/DemoApplication.cpp b/Demos/OpenGL/DemoApplication.cpp index c8f3073c7..4d129deca 100644 --- a/Demos/OpenGL/DemoApplication.cpp +++ b/Demos/OpenGL/DemoApplication.cpp @@ -773,6 +773,8 @@ void DemoApplication::mouseMotionFunc(int x,int y) btRigidBody* DemoApplication::localCreateRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape) { + btAssert(shape->getShapeType() != INVALID_SHAPE_PROXYTYPE); + //rigidbody is dynamic if and only if mass is non zero, otherwise static bool isDynamic = (mass != 0.f); diff --git a/Extras/GIMPACT/include/GIMPACT/Bullet/btGImpactShape.h b/Extras/GIMPACT/include/GIMPACT/Bullet/btGImpactShape.h index 6a73bcbdd..0885b23c7 100755 --- a/Extras/GIMPACT/include/GIMPACT/Bullet/btGImpactShape.h +++ b/Extras/GIMPACT/include/GIMPACT/Bullet/btGImpactShape.h @@ -105,6 +105,7 @@ protected: public: btGImpactShapeInterface() { + m_shapeType = GIMPACT_SHAPE_PROXYTYPE; m_localAABB.invalidate(); m_needs_update = true; localScaling.setValue(1.f,1.f,1.f); @@ -150,10 +151,7 @@ public: } - virtual int getShapeType() const - { - return GIMPACT_SHAPE_PROXYTYPE; - } + /*! \post You must call updateBound() for update the box set. diff --git a/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp b/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp index 9d1c0b2e8..c00571372 100644 --- a/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp +++ b/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp @@ -21,6 +21,7 @@ subject to the following restrictions: btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInternalShape () { + m_shapeType = CAPSULE_SHAPE_PROXYTYPE; m_upAxis = 1; m_implicitShapeDimensions.setValue(radius,0.5f*height,radius); } diff --git a/src/BulletCollision/CollisionShapes/btCompoundShape.cpp b/src/BulletCollision/CollisionShapes/btCompoundShape.cpp index 103b60ed4..758662474 100644 --- a/src/BulletCollision/CollisionShapes/btCompoundShape.cpp +++ b/src/BulletCollision/CollisionShapes/btCompoundShape.cpp @@ -24,6 +24,7 @@ m_collisionMargin(btScalar(0.)), m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.)), m_dynamicAabbTree(0) { + m_shapeType = COMPOUND_SHAPE_PROXYTYPE; void* mem = btAlignedAlloc(sizeof(btDbvt),16); m_dynamicAabbTree = new(mem) btDbvt(); btAssert(mem==m_dynamicAabbTree); diff --git a/src/BulletDynamics/Dynamics/btRigidBody.cpp b/src/BulletDynamics/Dynamics/btRigidBody.cpp index e2afb687a..653aab885 100644 --- a/src/BulletDynamics/Dynamics/btRigidBody.cpp +++ b/src/BulletDynamics/Dynamics/btRigidBody.cpp @@ -143,8 +143,17 @@ void btRigidBody::setDamping(btScalar lin_damping, btScalar ang_damping) ///applyDamping damps the velocity, using the given m_linearDamping and m_angularDamping void btRigidBody::applyDamping(btScalar timeStep) { + //On new damping: see discussion/issue report here: http://code.google.com/p/bullet/issues/detail?id=74 + //todo: do some performance comparisons (but other parts of the engine are probably bottleneck anyway + +//#define USE_OLD_DAMPING_METHOD 1 +#ifdef USE_OLD_DAMPING_METHOD m_linearVelocity *= GEN_clamped((btScalar(1.) - timeStep * m_linearDamping), (btScalar)btScalar(0.0), (btScalar)btScalar(1.0)); m_angularVelocity *= GEN_clamped((btScalar(1.) - timeStep * m_angularDamping), (btScalar)btScalar(0.0), (btScalar)btScalar(1.0)); +#else + m_linearVelocity *= btPow(btScalar(1)-m_linearDamping, timeStep); + m_angularVelocity *= btPow(btScalar(1)-m_angularDamping, timeStep); +#endif if (m_additionalDamping) {