brDefaultMotionState::getWorldTransform was wrong, in case of a non-identity centerOfMassOffset.

Thanks to Mathias for the report/fix.
This commit is contained in:
Erwin Coumans
2014-01-16 18:47:03 -08:00
parent 0ed7b5c508
commit 6142bdca0a

View File

@@ -25,14 +25,14 @@ ATTRIBUTE_ALIGNED16(struct) btDefaultMotionState : public btMotionState
///synchronizes world transform from user to physics ///synchronizes world transform from user to physics
virtual void getWorldTransform(btTransform& centerOfMassWorldTrans ) const virtual void getWorldTransform(btTransform& centerOfMassWorldTrans ) const
{ {
centerOfMassWorldTrans = m_centerOfMassOffset.inverse() * m_graphicsWorldTrans ; centerOfMassWorldTrans = m_graphicsWorldTrans * m_centerOfMassOffset.inverse() ;
} }
///synchronizes world transform from physics to user ///synchronizes world transform from physics to user
///Bullet only calls the update of worldtransform for active objects ///Bullet only calls the update of worldtransform for active objects
virtual void setWorldTransform(const btTransform& centerOfMassWorldTrans) virtual void setWorldTransform(const btTransform& centerOfMassWorldTrans)
{ {
m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset ; m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset;
} }