- Home /
simultaneously apply torque around 2 different axes
Hi again
I'm trying to achive a rotation around the world axis while also rotating around a local axis. For an example a 360 flip with a skateboard: https://www.youtube.com/watch?v=WsgrgDrOFDs The board rotates 360 degrees around the world y-axis and also rotates 360 around its own local axis.
An other example is from diving: https://www.youtube.com/watch?v=L5Md87Le1xU
By using transform.rotation i can get the rotation i'm looking for, but i would like to make it more physics based, so would it be possible to achive by using torque?
Thanks in advance
Heh - this is a very tricky math question. Just try it ! simply apply local torques.
I'd think:
rb.AddTorque(rb.transform.right * fliprate); //to make the body do a forward flip whichever way it happens to be facing
rb.AddTorque(Vector3.up* spinrate); //to make the body spin around world-Y
applying both in the same FixedUpdate should effectively be simultaneous. Though as bunny mentions, the resultant angular velocity will be about some "combination" axis. (that should be ok tho)
Answer by Bunny83 · May 01, 2017 at 01:48 AM
Well, any rigidbody object will rotate only around one axis at a time unless some sort of external force is applied. If you apply an impulse force around two different axis, the rigidbody will rotate around a combined axis that might be diagonal between your axes.
Note that rigidbody simulation is always simulated in worldspace. That's also true for the realworld, however the rotation of the earth is so slow that in most cases you can ignore it. Another important factor is the inertia tensor of the object. It represents the moment of inertia and basically specifies how much rotational resistance the object has around 3 axis. A skateboard can much easier "roll" around it's long axis than around the other two axis.
Unity calculates the inertia tensor based on the used colliders. However realworld objects usually have a non linear mass distribution. Most rigidbody systems assume an equal distributed mass / density. What you can control is where the center of mass is located.
A rigidbody object can't rotate around two different axis at the same time. It only has one rotation axis. If it appears to be rotating around two axis, it's either just a combined rotation axis, some sort of force / torque is applied or the moment of inertia changes over time. In your diving example a human can do both, change the moment of inertia of the body and apply torque by moving his arms / legs.
There was already a similar question a couple of years ago.
Your answer
Follow this Question
Related Questions
Compute the torque needed to rotate an object at a constant rate 3 Answers
How does unity add torque 1 Answer
How to decrease inertia for a rolling ball 1 Answer
Working with Physics 0 Answers
How to apply frictional Torque 2 Answers