getInvInertiaTensorWorld() == 0 ??!!

Post Reply
mp3butcher
Posts: 13
Joined: Wed Jun 06, 2007 8:05 am

getInvInertiaTensorWorld() == 0 ??!!

Post 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
mp3butcher
Posts: 13
Joined: Wed Jun 06, 2007 8:05 am

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

Post 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
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

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

Post 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().
Post Reply