LocalInertiaTensor and LocalInertiaTensorInverse

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
run
Posts: 10
Joined: Thu Jun 02, 2011 8:36 am

LocalInertiaTensor and LocalInertiaTensorInverse

Post by run »

More experiments, more questions.

Setting the LocalInertiaTensor seems to have no effect on the
values needed to move the object with ApplyImpulse, ApplyAngularImpulse,
AngularVelocity, or AngularMomentum.

I think I understand why that's true with ApplyImpulse; it's simply pushing
the object and the rotation happens because the object is constrained by
a ballsocket joint, but the others are angular so I thought they'd require
different values.

Obviously I'm wrong, but I'm not sure why.

From what I can glean through searching/reading/experiments,
the LocalInertiaTensorInverse can be used to eliminate unwanted
spin by setting that plane's part of the martix to zero; and that
works as expected. But now I'm really unclear about what setting
the LocalInertiaTensor is suppose to do.

I'm using the most current development fork.

-Jeff
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: LocalInertiaTensor and LocalInertiaTensorInverse

Post by Norbo »

The inertia tensor can be considered 'angular mass,' so changing the inertia tensor will indeed modify how angular velocity changes in response to angular impulses.

The inertia tensor is set up such that you can create analogous equations. LinearMomentum = Mass * LinearVelocity becomes AngularMomentum = InertiaTensor * AngularVelocity. Mass is a scalar and the InertiaTensor is a positive-semidefinite matrix that behaves a bit like a scalar.

So, just like mass, if the inertia tensor is scaled up (multiply all components by the same factor), an angular impulse will produce a change of angular velocity in the same direction as before, but of a smaller magnitude. Similarly, if the inertia tensor is scaled down, the angular velocity change will have a greater magnitude. These 'pure scaling' type modifications to the inertia tensor are the most common since they're simple and use the engine-computed inertia tensors to ensure proper change directions.

Nonscaling changes to the inertia tensor effectively change the mass distribution as far as rotation is concerned. You can think of constructing an inertia tensor as summing the contributions from a bunch of individual points in an object. Points that are farther away contribute more angular 'weight' to the appropriate axes.

Setting local inertia tensor inverse rows (or the entire matrix) to zero is a nonphysical operation which forces it to think of the local inertia tensor as infinite along certain axes, stopping all motion around those axes. This is taking the above definition to the extreme.

All that said, if an impulse doesn't seem to have the intended effect, something is likely interfering. A BallSocketJoint, for example, applies both linear and angular impulses. If the anchor point is aligned with the entity's center of mass, the BallSocketJoint won't contribute to or interfere with angular motion.
run
Posts: 10
Joined: Thu Jun 02, 2011 8:36 am

Re: LocalInertiaTensor and LocalInertiaTensorInverse

Post by run »

I think I've sorted things out; and as always, thank you for your patience.

The experiment I was working on was a first attempt to get a more accurate moment of inertia for objects attached to a constraint,
since the default inertia tensor assumes rotation around the center of mass.

I computed that new moment two different ways; 1:the parallel axis theorom and 2: the rectangular section spoke/spoke not starting at rotational axis method
and was getting very different values. After your reply confirmed that what I was trying to do should work, I went back and checked my math again.
Turns out I messed up the spoke method (very badly) and that happened to be the one I was using for the sim. The number seemed more related
to the the default moment, but that was just coincidence.

With that fixed both methods now yield the same result and using the correct values helped a great deal. In my defense I was doing the multiplication and division
correctly. What I neglected to do was compute the mass for the two imaginary objects required by the spoke method and was plugging in the "real" object's mass.
So, garbage in garbage out.

Several other little issues also added to the confusion, making kind of a little mini perfect storm of "nothing's changing when I change this".

One was my expectation that the stall torque I'd previous computed would need to be different with an adjusted local inertia tensor.
In hindsight I'm not sure why I thought that. After all, gravity didn't change, the object's mass and it's offset from the pivot point didn't change, so there's
no reason for the stall torque to be different and in that regard nothing changing was the correct result.

Ah well, mistakes are learning; so long as you don't keep making the same ones.

Anyone else interested in even more Moment of inertia, besides checking out the links Ross provided, should take a look a this page:

"Proofs of moment of inertia equations"
http://homepages.which.net/~paul.hills/ ... roofs.html

Though the equations only work if you do them properly :)

Thanks again,

-Jeff
Post Reply