Jump to content
• Advertisement

# A variety of inertial problems

This topic is 2556 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I am writing a spaceship game, where my ships are made up of components parts. These component parts can be added and removed on-the-move.

I have a few problems here.
When I add a block to a ship, I calculate where the new center of gravity is. I also calculate the new inertial tensor.

Problem 1)
Originally the rigid body is rotating about an axis through its center of mass. Now I add a new block, which causes the center of mass to move someplace else. This causes a startling jump of the entire rigid body as the rotation continues, but around the new CG. (I shift the rendering of my blocks to account for the center change, and this seems to work when at rest, and during linear translation). My new block contributes no momentum to the rigidbody. The rotation DOES slow down, on account of the increased tensor, so this is working correctly.
I imagine, that in the real world, if the CG of a spinning object suddenly changed, that some kind of oscillation/procession would occur until the rotation adopted the new CG. Does this occur? How? What is a good way to handle this in a rigid body simulation?

Problem 2)
Easy one. I am incrementing my tensor instead of completely recalculating the entire thing every time a block is added to the rigidbody. So I am trying to use the parallel axis theory. The wiki shows this as (moment of inertia + mass*distancefromaxis^2).
For a MASS moment of inertia, should this not be "Mass*Icm + Mass*r^2"? I dont understand how they are trying to add "meters^2" and "kg*meters^2". Units must be consistent for addition.

Problem 3)
In the process of adding blocks, it will be inevitable that my inertia tensor is no longer aligned with the principal axis of inertia (no longer diagonal with zeroes elsewhere). Is this a problem? Should I be swinging the axis I render on in such a way that the tensor stays diagonal? I am using the entire tensor currently, not just 3 floats, so I sort of assume it should work, but have not really figured a way to test it.

Thanks!

#### Share this post

##### Share on other sites
Advertisement
1) For rigid bodies, the change is instantaneous. Imagine two rigid bodies colliding with each other. Since they do not deform, momentum is transferred between them instantaneously (I think, anyways). Think billiard balls. You could probably cheat your way around this by having some sort of "tractor beam" that will gradually speed up the component that's being added to the ship so the effect looks less jarring. That would probably create the visual effect you're intending.

2) Moment of inertia is in kg*meter^2. It's defined as , and the tensor form is defined similarly. I've heard that the terminology can be a little inconsistent though. Also, you may want to look at the formula given for the parallel axis theorem on the original page for moment of inertia, since it gives you the generalized tensor equation for moment of inertia.

3) As long as you're storing rotational position correctly (either roll-pitch-yaw or axis-angle), then the moment of inertia tensor should not affect your rendering in any way.

#### Share this post

##### Share on other sites

1) For rigid bodies, the change is instantaneous. Imagine two rigid bodies colliding with each other. Since they do not deform, momentum is transferred between them instantaneously (I think, anyways). Think billiard balls. You could probably cheat your way around this by having some sort of "tractor beam" that will gradually speed up the component that's being added to the ship so the effect looks less jarring. That would probably create the visual effect you're intending.

Well, my blocks kind of spontaneously appear out of thin air, so that probably has a lot to do with the bizarre behavior. I suppose the closest real life analog would be a stationary blob instantaneously welding itself to a rotating blob. Strange things are bound to happen, there, I suppose.

2) Moment of inertia is in kg*meter^2. It's defined as , and the tensor form is defined similarly. I've heard that the terminology can be a little inconsistent though. Also, you may want to look at the formula given for the parallel axis theorem on the original page for moment of inertia, since it gives you the generalized tensor equation for moment of inertia.
[/quote]

Ah, good. That is kind of what I figured, but it wasn't very clear in the numerous explanations I came across.

3) As long as you're storing rotational position correctly (either roll-pitch-yaw or axis-angle), then the moment of inertia tensor should not affect your rendering in any way.
[/quote]

Maybe rendering was the wrong way to put it. I was worried that multiplying my rotational momentum by the entire tensor (not just a diagonal) would cause some strange artifacts. Every paper I can find on rigid body dynamics suggests using the inertia tensor around the principal axis. My rotation is stored in a quaternion, as far as that matters.

I appreciate the response, it sounds like I am at least in the right ballpark.

#### Share this post

##### Share on other sites
Well, as long as your axes are constructed using the same coordinate system as the tensor, then you should have no issues. The papers probably suggested using the inertia tensor around the principal axis so that the number of calculations is cut down, but that's just a wild guess on my part. If you were to rotate your coordinate system so that your inertia tensor was around the principal axis, you would just have to make sure you also apply this rotation to all of your other axes as well. I've never tried it myself though, so you should try and apply a known rotation to the coordinate system so that the tensor is no longer around the principal axis, then see if axes constructed using the new coordinate system give the same values for moment of inertia as the original unrotated tensor.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
23
3. 3
JoeJ
20
4. 4
5. 5
• Advertisement

• 27
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631737
• Total Posts
3001944
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!