- Home /
How to rotate An object around another axis using Torque?
Hi all,
I am trying to apply torque on a corner of a cube, so that it moves around its corner. But AddTorque applies torque around its center. How to rotate it around its corner? Also i have to rotate using torque or Force only (not by simply rotating it).
Cheers, VJ
Answer by CHPedersen · May 06, 2011 at 09:50 AM
Maybe make the cube the child of an empty GameObject, and then translate the cube half its width along 2 axes? That will cause the side of the cube to align with the origin of its parent object. Then, if you apply torque to the parent object, the child cube will rotate with respect to its side rather than its own origin.
For this the parent has to be given a rigidbody. I just tried that but it is giving a very jerky rotation...
I Applied simple Torque to the parent
void FixedUpdate()
{
rigidbody.AddRelativeTorque(Vector3.up * 10);
}
But the motion is very jerky if applied to Parent...
Answer by Saturnix · Nov 08, 2012 at 02:44 PM
Attach the cube to another object using fixed joint. Place the object where you'd like the rotation axis to be (in this case a corner of the cube) and then apply the torque (to the object, not to the cube).