Hello,
Until now I just used the principal axes of inertia to specify my inertia (i.e. 3 values), but now I need to be able to accomodate for random shapes and random moment of inertia, thus my question:
My input is: a moment of inertia tensor. 9 elements, mirrored matrix (about the diagonal)
My desired output: the principal inertias (3 values) and a rotation matrix that specified the frame of the principal inertias
Or
Can I directly specify a moment of inertia tensor in Bullet?
Now I do it like that:
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,collisionShape,localInertia_3Values);
Moment of inertia tensor to Bullet?!
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Moment of inertia tensor to Bullet?!
If you have a btMatrix3x3 inertia you can diagonalize it like this:
You will have to store your shape in a btCompoundShape so that the rigid body world transform is still aligned with the principal axis and center of mass.
See also http://code.google.com/p/bullet/source/ ... pe.cpp#214
and Bullet/Demos/FractureDemo on some example use of calculatePrincipalAxisTransform.
Thanks,
Erwin
Code: Select all
btTransform principal;
principal.setIdentity();
btMatrix3x3 inertia(...);
tensor.diagonalize(principal.getBasis(), btScalar(0.00001), 20);
inertia.setValue(tensor[0][0], tensor[1][1], tensor[2][2]);
See also http://code.google.com/p/bullet/source/ ... pe.cpp#214
and Bullet/Demos/FractureDemo on some example use of calculatePrincipalAxisTransform.
Thanks,
Erwin