added synchronizeSingleMotionState, thanks Chunky.
This commit is contained in:
@@ -250,18 +250,11 @@ void btDiscreteDynamicsWorld::applyGravity()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void btDiscreteDynamicsWorld::synchronizeSingleMotionState(btRigidBody* body)
|
||||||
void btDiscreteDynamicsWorld::synchronizeMotionStates()
|
|
||||||
{
|
{
|
||||||
BT_PROFILE("synchronizeMotionStates");
|
btAssert(body);
|
||||||
{
|
|
||||||
//todo: iterate over awake simulation islands!
|
|
||||||
for ( int i=0;i<m_activeObjects.size();i++)
|
|
||||||
{
|
|
||||||
btCollisionObject* colObj = m_activeObjects[i];
|
|
||||||
|
|
||||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
if (body->getMotionState() && !body->isStaticOrKinematicObject())
|
||||||
if (body && body->getMotionState() && !body->isStaticOrKinematicObject())
|
|
||||||
{
|
{
|
||||||
//we need to call the update at least once, even for sleeping objects
|
//we need to call the update at least once, even for sleeping objects
|
||||||
//otherwise the 'graphics' transform never updates properly
|
//otherwise the 'graphics' transform never updates properly
|
||||||
@@ -274,6 +267,21 @@ void btDiscreteDynamicsWorld::synchronizeMotionStates()
|
|||||||
body->getMotionState()->setWorldTransform(interpolatedTransform);
|
body->getMotionState()->setWorldTransform(interpolatedTransform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void btDiscreteDynamicsWorld::synchronizeMotionStates()
|
||||||
|
{
|
||||||
|
BT_PROFILE("synchronizeMotionStates");
|
||||||
|
{
|
||||||
|
//todo: iterate over awake simulation islands!
|
||||||
|
for ( int i=0;i<m_activeObjects.size();i++)
|
||||||
|
{
|
||||||
|
btCollisionObject* colObj = m_activeObjects[i];
|
||||||
|
|
||||||
|
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||||
|
if (body)
|
||||||
|
synchronizeSingleMotionState(body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ public:
|
|||||||
|
|
||||||
virtual void synchronizeMotionStates();
|
virtual void synchronizeMotionStates();
|
||||||
|
|
||||||
|
///this can be useful to synchronize a single rigid body -> graphics object
|
||||||
|
void synchronizeSingleMotionState(btRigidBody* body);
|
||||||
|
|
||||||
void addConstraint(btTypedConstraint* constraint, bool disableCollisionsBetweenLinkedBodies=false);
|
void addConstraint(btTypedConstraint* constraint, bool disableCollisionsBetweenLinkedBodies=false);
|
||||||
|
|
||||||
void removeConstraint(btTypedConstraint* constraint);
|
void removeConstraint(btTypedConstraint* constraint);
|
||||||
|
|||||||
Reference in New Issue
Block a user