- Home /
Adding torque and TransformDirection
Hi!
I have a problem while using TransformDirection() and InverseTransformDirection(), i think I haven't understood how they should be used.
I have some rigidbodies in a parent-child relationship, i want to apply forces to them so my initial attempt is:
myRigidbody.AddRelativeTorque(myTorque);
But looking at the documentation, TransformDirection() and the inverse one are used to transform a direction from local to global and the opposite so, the following code should do the same thing as the previous one, as far as I know:
// Transform to world space
myTorque = transform.TransformDirection(myTorque);
// Transform to his parent's local space
myTorque = parentTransform.InverseTransformDirection(myTorque);
// And apply it
myRigidbody.AddTorque( myTorque );
To sum up, I have transform the torque to world coordinates, then to the parent's transform local coordinates, and finally applied it with AddTorque instead of AddRelativeTorque...
But I obtain quite different results in the practise, so, do you know what am I misunderstanding??
Your answer
![](https://koobas.hobune.stream/wayback/20220613004956im_/https://answers.unity.com/themes/thub/images/avi.jpg)