5
\$\begingroup\$

so I am trying to determine exactly how much torque to apply to a 3d model to make it rotate at a particular rate. I apply force from the location of each engine on the craft so if one breaks the craft should start to spiral out of control. Unity provides the inertia tensor which as far as I can figure out is the distribution of mass simplified to a vector? I am assuming Unity's own physics system relies on the same vector.. If I had a target rotation speed and for the sake of simplicity wanted to accelerate to it over one frame I'd like to be able to do something like:

AddForce(targetAngularVelocity * rigidbody.mass * rigidbody.inertiaTensor.magnitude);

assuming the inertiaTensor has a magnitude of the average distribution of mass is that how it works? hopefully you get the point because im making some assumptions here I can't really seem to find a clear answer - that I understand anyway :)

A better explanation: I can get the angular velocity of a rigidbody from unity, but how do I convert that into torque using the inertia tensor. For example if you have two rotating spheres both with the same mass and angular velocity but one is larger, the larger one will take more torque to stop it because of its mass distribution. How do I utilise the inertia tensor to determine the torque required?

Thank you

Update:

Been messing around with the tensor, created a 3D object -> Cube in Unity, added a rigidbody, then added a second cube as a child of the first. By moving the child cube the inertia tensor changes.. I set Unity to draw a vector of the inertia tensor.. it did appear at first to remain constantly perpendicular to the mass distribution.. but it seems to only be directed along a positive diagonal along the plane closest to that perpendicular of the mass distribution..

I really need someone with knowledge on the topic to shed some light on this. What does Unity use to determine how a mass will react to a force offset from the centre of mass? I just need to know how to predict how Unity will react by applying a throttle to a single engine on, for example the wing of the plane.

The tensor appears strangely simple? can only span along 3 directions, each a positive only diagonal along a plane perpendicular to the distribution of mass.. an estimate almost? with a degree of error of 90 degrees?

Please tell me I'm missing something

Update 2:

2 upvotes, must be a record for me, so I've put some more time in haha, I hope this helps someone.

so theres another Vector3 I should have looked at long ago.. Unity also supplies Rigidbody.inertiaTensorRotation which is the euler angles for the rotation of the inertia tensor. After drawing a vector along the inertia tensor rotated by the cubes local rotation and also the inertia tensor rotation it works. The line still flickers at 90 degree rotations but it doesn't matter as it is representing the distribution of mass out from the axis that is running through the transforms position and it's centre of mass. In other words rotating the inertia tensor around the imaginary vector connecting the 2 cubes won't change it's meaning, hence why I draw the 4, it stopped the change.

The picture here shows the inertia tensor, in white. That was confusing me before as it is in global co-ordinates. The way it changes to match (to a degree) the rotation of the cubes distribution of mass made me think it was local co-ords. The green lines indicate the inertia tensor. I have drawn it 4 times, each rotated 90 degrees around the axis going through the transforms position and its centre of mass. The inertia tensor randomly changes between one of these 4, but the way it changes doesn't change how it represents the inertia moment.. just look at the pic ;)

white line is inertia tensor, green are inertia tensor rotated by inertia tensor rotation vector

So the inertia tensor after rotating is like a plane around the axis that mass is distributed along. Because the mass is only the 2 cubes, the distribution is by a majority along the axis going through the transforms location and its centre of mass. the inertia tensor is also slightly tipping towards one of the cubes if you look closely. That is representing the slight distribution out perpendicular to the vector I keep mentioning running through the transforms position and its centre of mass (or draw a line between the 2 cubes).

Oh yeah, so how do I use this magical vector to determine the torque required to rotate it to a specific angular momentum?


Update, again.. Sorry to keep coming back to this, it is driving me insane. All I need to know is how the inertia tensor affects the resulting angular momentum after a torque is applied.


\$\endgroup\$
3
  • \$\begingroup\$ How much high school physics do you know? How much high school algebra do you know? You are operating under a misunderstanding of the relevant physics, which is why I ask. \$\endgroup\$ Sep 9, 2015 at 21:58
  • \$\begingroup\$ High school maths - no problem. High school physics I would have loved but they didn't let me elect the course because I don't like homework.. that is one topic I wouldn't have minded though I am entirely self taught with programming + what I do know of physics, love the topic, astronomy too. The point is I don't want you to think I'm simply not interested in the complicated stuff - I just don't know exactly where to go with this question. I have searched and not found complete answers to similar questions. If you know information bases with the knowledge I'm missing please point me around :) \$\endgroup\$
    – Aaron
    Sep 10, 2015 at 9:43
  • \$\begingroup\$ More after I eat. In the meantime, you could always do worse than to check out Feynman Lectures in Physics if you have access to a good library. It was also back in print again last year - I saw it in Chapters. \$\endgroup\$ Sep 10, 2015 at 21:35

2 Answers 2

3
\$\begingroup\$

In Unity, the inertia tensor is represented by a vector of the diagonal of the actual inertia tensor. That is to say, there are no off-diagonal elements in the inertia tensor. As Pieter mentioned, you need to think of the inertia tensor as the mass of the object. Once you do that, you can draw results from correspondence to linear equations. We all know that F = m * a, so in rotational terms, T = I * alpha, where I is your inertia tensor and alpha is your angular acceleration. There is one GIANT difference, though. I is a tensor and not a scalar. That means you need to do matrix math to get it right. Luckily, the simplification in Unity is that I is diagonal, so you can just treat it like a "magnitude", ie, T_x = I_x * alpha_x and so forth for each of the three components.

Now, in your problem statement, you are trying to figure out how T affects L, where L is your angular momentum vector. Well, going back to our linear correspondence, we know that L = I * omega, where omega is the angular velocity since p = m * v. We also know that alpha = omega / dt since a = v / dt. Let's put that together:

T = I * alpha = I * omega / dt = L / dt

So

T * dt = L

Which means that the change in angular momentum is simply torque multiplied by the amount of time you apply the torque! So the answer you seek is that the inertia tensor doesn't affect the angular momentum change due to a torque. It will however affect the angular velocity since

T * dt = L = I * omega

So if you want your angular velocity components and not the momenta, then simply divide the components of your torque by the corresponding components of the inertia tensor, ie,

T_x * dt / I_x = omega_x
\$\endgroup\$
1
\$\begingroup\$

Let's correlate linear and angular terms, since most people have more intuition for linear kinematics and dynamics than angular, and for the moment assume a single axis of rotation:

Linear Term                        Angular Term
-------------------------------    --------------------------------------------------------
Mass                               Moment of Inertia
Velocity                           Angular Velocity
Force                              Torque
Momentum = Mass * Velocity         Angular Momentum = Moment of Inertia * Angular Velocity
Impulse = Change in Momentum       Angular Impulse = Change in Angular Momentum 
Acceleration = rate of change of   Angular Acceleration = rate of change of 
               velocity                                   angular velocity

Your question asks how to calculate the torque necessary to induce a specified change in angular velocity. Undoubtedly you have an unknown t floating around in your equations that you don't know how to solve for.

You need to look at this first from a kinematics standpoint.

  • Calculate the Angular Impulse necessary to induce the required change in Angular Momentum;
  • Decide the time behaviour of this Angular Impulse:
    • As a point change, like billiard balls on a pool table;
    • Constant application over a finite time, like rocket thrusters; or
    • something more esoteric.

In the first case, you simply apply the Angular Impulse at a moment in time, and the angular velocity changes to the new value instantaneously.

In the second you either pre-determine the length of time in which you wish the change to occur, or calculate the length of time from a maximum available torque. Both of these case involve solving a quadratic equation. You then apply the calculated/specified torque for the specified/calculated time.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you for the answer, it has helped but I think there's still something I'm missing. If an object is spinning at a particular rate I can calculate the torque required to stop it using the moment of inertia. However the torque won't be applied directly to the rigid body as a torque. I have engines in different configurations. If I fire an engine that is not in the centre of the object, the way that mass is distributed will affect the way the object spins as the distribution is different between the axes. How do I calculate for this offset? A long object will roll more easily than it'll yaw \$\endgroup\$
    – Aaron
    Sep 12, 2015 at 5:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .