predictUnconstraintMotion with DISABLE_SIMULATION

Bbilz
Posts: 26
Joined: Wed Feb 27, 2008 9:55 am

predictUnconstraintMotion with DISABLE_SIMULATION

Post by Bbilz »

Hi,

I find using DISABLE_SIMULATION a useful tool in activating/deactivating physics objects, but was wondering about its behaviour. In predictUnconstraintMotion there is no check against the active state of the rigid body, so even inactive objects have their velocities integrated, damping applied and their predicted motion calculated.

I was wondering if there was a reason for this, or if like elsewhere (integrateTransforms) it should check if the rigid body is active as well as if it is not static/kinematic
Thus changing the function to this:

Code: Select all

BT_PROFILE("predictUnconstraintMotion");
for ( int i=0;i<m_nonStaticRigidBodies.size();i++)
{
	btRigidBody* body = m_nonStaticRigidBodies[i];
	if (body->isActive() && !body->isStaticOrKinematicObject())
	{
		body->integrateVelocities( timeStep);
		//damping
		body->applyDamping(timeStep);

		body->predictIntegratedTransform(timeStep,body->getInterpolationWorldTransform());
	}
}
Currently it means that objects with simulation disabled get velocities applied to them, which is not what you would expect.