Description
The RotationToLocal
method of the Transform
struct converts a given world rotation into the local rotation relative to the transform. This is useful when you need to understand how a global rotation is perceived from the perspective of a specific transform.
Usage
To use the RotationToLocal
method, you need an instance of a Transform
and a Rotation
that represents the world rotation you want to convert. Call the method with the world rotation as the parameter, and it will return the equivalent local rotation.
Example
// Assume 'transform' is an instance of Transform
// and 'worldRotation' is a Rotation in world space
Rotation localRotation = transform.RotationToLocal(worldRotation);
// Now 'localRotation' represents the rotation relative to 'transform'.