Dirk Gregorius wrote:[...] IIRC Bullet doesn't compute the principal axes, but simply throws away the non-diagonal elements.
-Dirk
Dirk, thanks for trying to help out, but your answer is not entirely correct.
Bullet defines the rigid body local coordinate frame to be equal to the center of mass and aligned with the principle axis of inertia. So for rigid bodies with basic shapes such as a btBoxShape, only the diagonal needs to be stored. Non-diagonal elements are zero and no values are 'thrown away'.
frca wrote:
It seems impossible to set my user computed inertia tensor for a body. Am I missing something?
If the inertia tensor of your collision shape is not diagonal, you need to re-align the collisionshape using a btCompoundShape, and apply the inverse inertia transform to the child shape.
btCompoundShape::calculatePrincipalAxisTransform computes the principle axis transform given a collection of child shapes, child transforms and their respective masses.
See attached BasicDemo, that shows how to use this calculatePrincipalAxisTransform to apply this inverse transform into a btCompoundShape, to realign the collision shape(s) so that the center of mass and principle axis of inertia is aligned with the local transform of the rigid body.
Thanks,
Erwin
You do not have the required permissions to view the files attached to this post.