setMassSpaceInertiaTensor [solved]

OgreMage

03-05-2008 01:56:00

what is setMassSpaceInertiaTensor for? it did not come up in the forum or doc search. I am using NxOgre with PhysX

thank you!

betajaen

03-05-2008 08:57:15

For developers lacking dynamics experience, inertia tensor may be the most unusual aspect of a body. As mentioned in the Rigid Body Properties section, its purpose is to describe the bodies mass distribution, which may not be available otherwise, since the actual shape is not always stored. Even if shapes are available, sometimes it is preferred to use mass settings not strictly compatible with the shapes in order to achieve some particular effect.


Thus the inertia tensor expresses how hard it is to rotate the shape in various directions. For example, one can intuitively imagine that a long thin cylinder (like a printing drum) is easy to turn along its length axis, but if it were suspended on a chain, it would be much more difficult to swing around (especially if you push it near the middle where the chain is attached, as opposed to the ends which give a great deal more leverage).


Formulas in high school physics books tell you how to compute the moment of inertia for a particular shape. Unfortunately, these entry-level books only give you a scalar value, which is the moment of inertia along some specified axis. In the SDK we need to use a matrix quantity, which describes the inertia along all possible axes. The inertia can be expressed either in the local space of the body or the global space, as can all vector or matrix quantities.


Internally, this matrix is decomposed into a rotation and a vector, which is both faster and more intuitive to use than the dense matrix because the rotation gives the center of mass an orientation relative to the actor.


When you create a body, you will want to specify a moment of inertia. The default is the identity, which is most likely inappropriate for your shape. The easiest option is to assign collision detection shapes to the actor, along with either a density or a total mass. The inertia tensor will be automatically computed from this data. You may, of course, set the tensor yourself (having computed it earlier with the previous method), which is more efficient. The SDK contains a wide selection of utility functions to compute and manipulate inertia tensors. See the files NxExportedUtils.h and NxInertiaTensor.h in the SDK API documentation. Also, for meshes, the methods NxConvexMesh::getMassInformation and NxTriangleMesh::getMassInformation are useful.


PhysXDocumentation.chm, Guide, Basics, Actors, The Inertia Tensor.

OgreMage

03-05-2008 16:59:20

LOL, OK, PERFECT! SOLVED!