lianlab / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

Torque for 'MotionActuator' is not applied to DYNAMIC body due to 'm_angularFactor' being zero (0,0,0). #128

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Setup i.e. box on some ground (static body) in blender and set 'Physics 
Type' to Dynamic.
2. Bind for that body a keyboard 'sensor' to i.e. left and connect to Motion 
Actuator where torque is applied (i.e. (0,0,10)).
3. Run within gamekit and press left key. 

What is the expected output? What do you see instead?
No torque is applied.

What version of the product are you using? On what operating system?
Build from trunk on Ubuntu.

Please provide any additional information below.
Within method 'applyTorque' from btRigidBody.h there is a 'm_angularFactor' 
multiplied (*) with given 'torque' vector. Debbuging showed that it is
set to zero vector (0,0,0) so the final vector is zero (0,0,0). Therefore no
torque is applied for Dynamic body. 

Please check solution from Blender found at:
https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/gameengine/Physi
cs/Bullet/CcdPhysicsController.cpp

//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(1,1,1);
body->setAngularFactor(tmpFac);
body->applyTorque(torque);
body->setAngularFactor(angFac);

It seems that they solved problem by setting angular factor to (1,1,1).

Original issue reported on code.google.com by mirza.hu...@gmail.com on 16 Jan 2011 at 12:36

GoogleCodeExporter commented 9 years ago
Fixed at r809.
Thanks.

Original comment by harkon...@gmail.com on 17 Jan 2011 at 9:05