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 transform's current orientation.
Usage
Use the Right
property when you need to calculate or apply transformations that involve the rightward direction of an object. This can be particularly useful in scenarios such as moving an object to the right, aligning objects, or calculating cross products for physics simulations.
Example
// Example of using the Right property
Transform transform = new Transform();
Vector3 rightDirection = transform.Right;
// Move an object to the right by 5 units
Vector3 newPosition = transform.Position + rightDirection * 5;
transform.Position = newPosition;