Description
The Right
property of the Transform
struct provides the right direction vector of the transform in world space. This vector is perpendicular to both the Up
and Forward
vectors, forming a right-handed coordinate system. It is useful for determining the rightward direction relative to the current orientation of the transform.
Usage
Use the Right
property when you need to determine the rightward direction of an object in world space. This can be particularly useful for movement calculations, aligning objects, or determining relative directions.
Example
// Example of using the Right property
Transform transform = new Transform();
Vector3 rightDirection = transform.Right;
// Use the rightDirection vector to move an object to the right
Vector3 newPosition = transform.Position + rightDirection * moveDistance;
transform.Position = newPosition;