Description
The Forward
property of the Transform
struct represents the forward direction vector of the transform. This vector is typically used to determine the direction in which an object is facing or moving. It is a unit vector in the local space of the transform, pointing in the forward direction relative to the transform's rotation.
Usage
Use the Forward
property to get the forward direction of a transform. This can be useful for operations such as moving an object forward, determining the direction of a raycast, or aligning objects in a scene.
Example
// Example of using the Forward property
Transform transform = new Transform();
Vector3 forwardDirection = transform.Forward;
// Move an object forward by 1 unit
transform.Position += forwardDirection * 1.0f;