Bugfix for [#18911] Applied torque breaks rigid bodies in game engine

This commit is contained in:
Erwin Coumans 2009-06-11 13:42:41 +00:00
parent bf729ab268
commit db8b4cee56

@ -1016,14 +1016,21 @@ void CcdPhysicsController::ApplyTorque(float torqueX,float torqueY,float torque
}
if (body)
{
//workaround for incompatibility between 'DYNAMIC' game object, and angular factor
//a DYNAMIC object has some inconsistency: it has no angular effect due to collisions, but still has torque
const btVector3& angFac = body->getAngularFactor();
btVector3 tmpFac(0,0,1);
body->setAngularFactor(tmpFac);
body->applyTorque(torque);
body->setAngularFactor(angFac);
}
if (m_cci.m_bRigid)
{
body->applyTorque(torque);
}
else
{
//workaround for incompatibility between 'DYNAMIC' game object, and angular factor
//a DYNAMIC object has some inconsistency: it has no angular effect due to collisions, but still has torque
const btVector3& angFac = body->getAngularFactor();
btVector3 tmpFac(0,0,1);
body->setAngularFactor(tmpFac);
body->applyTorque(torque);
body->setAngularFactor(angFac);
}
}
}
}