Description
The RotationToLocal
method of the Transform
struct converts a given world rotation to a local rotation relative to the transform. This is useful when you need to understand how a rotation in the world space relates to the local space of an object.
Usage
To use the RotationToLocal
method, you need to have a Transform
instance and a Rotation
object representing the world rotation you want to convert. The method will return a Rotation
object that represents the equivalent rotation in the local space of the transform.
Example
// Assume 'transform' is an instance of Transform
// and 'worldRotation' is a Rotation object representing a world rotation.
Rotation localRotation = transform.RotationToLocal(ref worldRotation);
// 'localRotation' now contains the rotation in the local space of 'transform'.