Predict rotation angle for torque applied?

I’m using AddTorque to rotate a RigidBody and I need to predict how many degrees it will rotate in one frame knowing the torque, the angular drag and the mass (which in my case is always 1).

I’ve searched around pretty much but wasn’t able to find a solution that fits my need, mostly because I’m not great with physics and couldn’t extrapolate the solution from other formulas. Any help is greatly appreciated!

This is pretty much that hardest problem you could face when it comes to rigidbody physics. Rotational momentum is quite complicated. Note that mass does’t matter for rotation. The intertia tensor is the mass equivalent for rotations. However for rotations it’s important how the mass is distributed. So it depends on the shape of the object. Unity calculates the intertia tensor from all collider volumes and the provided mass.

The 3x3 interia tensor in Unity is stored as a diagonal matrix (intertiaTensor) combined with a rotation (inertiaRotation). The diagonal matrix represents the inertia around each major axis. So the calculation of the angular acceleration based on a torque is already quite complex. On top of that Unity’s way to apply drag is not based on realworld physics but is simply a percentage drop of the angular velocity.

The angle change per frame is the angular velocity of the object. The terminal angular velocity depends on several factors. First of all Unity has a relatively low max angular velocity setting to ensure that physics do not get out of control. This has to be considered as well or you have to increase this limit in the physics settings. Other than that the terminal velocity is the balance between the acceleration due to the applied constant torque and the opposing drag.

I haven’t ever tried this for rotation but the helper methods over here should work the same for rotations, given the right values.

Note if the object you’re rotating does not have a uniform intertia around all axis and you apply a torque around a non local axis, so the axis relative to the object does change, it’s impossible to calculate a proper value as the angular acceleration is quite different depending on the applied axis.

When you’re dealing with a 2d rigidbody it becomes much easier as there’s only one intertia value and one axis to rotate around. In 3d it’s a nightmare ^^. Note that Unity’s 3d physics engine does not perserve angular momentum but angular velocity. This is a simplification but prevents certain real world phenomenon like the intermediate axis theorem which is responsible for the tumbling seen in this video at the end. So In Unity you never get such tumbling. Once you stop applying a torque the rotation axis does not change because Unity preserves the angular velocity instead of the angular momentum.

Over here I already tried to explain some of the implications. Here’s a gamedev question about the same topic.

Currently I don’t have Unity (or a programming environment in general) at hand so I can’t do any tests or provide any concrete code examples.

Unity physics dev answer this question here with a code sample.