Description
The RotationToLocal
method of the Transform
struct converts a given world rotation to a local rotation relative to the transform's current orientation. This is useful when you need to understand how a global rotation would be represented in the local space of an object.
Usage
To use the RotationToLocal
method, you need to have a Transform
instance. You can then call this method by passing a reference to a Rotation
object that represents the world rotation you want to convert. The method will return a new Rotation
object that represents the equivalent rotation in the local space of the transform.
Example
// Assume 'transform' is an instance of Transform
Rotation worldRotation = new Rotation(0, 90, 0); // Example world rotation
Rotation localRotation = transform.RotationToLocal(ref worldRotation);
// 'localRotation' now contains the rotation in the local space of 'transform'.