From db8b4cee565676658bf6042a05b763654769f3a2 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Thu, 11 Jun 2009 13:42:41 +0000 Subject: [PATCH] Bugfix for [#18911] Applied torque breaks rigid bodies in game engine --- .../Physics/Bullet/CcdPhysicsController.cpp | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index d22c09b4d3e..3e20203a4cc 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -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); + } + } } }