Page 1 of 1

getInvInertiaTensorWorld() == 0 ??!!

Posted: Tue Nov 25, 2008 1:12 pm
by mp3butcher
Hello,
I'm using The invInertiaTensorWorld in order to control the rotation of an object this way:

Code: Select all

btVector3 torq=(desiredangularvelocity-BulletBody->getAngularVelocity())/elapsedTime;
		btMatrix3x3 m=BulletBody->getInvInertiaTensorWorld();
		torq=torq*m.inverse();
		BulletBody->applyTorque(torq);
But i've a problem cause getInvInertiaTensorWorld() return sometime zero matrix. Is it normal?
Is it mean that whatever the torque i apply there will no rotation for this time step??
Please help

Re: getInvInertiaTensorWorld() == 0 ??!!

Posted: Tue Nov 25, 2008 3:15 pm
by mp3butcher
ok I found the bug: it comes from the local inertia that i set to (0,0,0). then i set it to (1,1,1)
Is there anyone that can help me to fix this parameter?
Is this local inertia fix the factor conditionning the temporal decrease of the rotation or other?
I just have some difficulties to represent what it is..can anybody help me?
thanks

Re: getInvInertiaTensorWorld() == 0 ??!!

Posted: Wed Oct 15, 2014 5:47 pm
by drleviathan
I was having the same problem here -- btRigidBody::getInvInertiaTensorWorld() would return a matrix of all zeros right after I had set the body's mass properties. After looking at the bullet source code I discovered that the world's inverse inertia tensor is only updated internally when needed (this makes sense because otherwise it would usually be wasted CPU cycles). In short, if you want to obtain it first call btRigidBody::updateInertiaTensor().