Description
The Rotation
field of the Transform
struct represents the rotational component of the transform. It is used to define the orientation of an object in 3D space. This field is public and non-static, allowing it to be accessed and modified directly on instances of the Transform
struct.
Usage
To use the Rotation
field, you can directly access it from an instance of the Transform
struct. This field is typically used in conjunction with the Position
and Scale
fields to fully define the transformation of an object in a scene.
Example
// Example of setting the Rotation field of a Transform
Transform myTransform = new Transform();
myTransform.Rotation = Rotation.FromAxis(Vector3.Up, 90.0f); // Rotate 90 degrees around the Up axis
// Example of getting the Rotation field of a Transform
Rotation currentRotation = myTransform.Rotation;
// Use the rotation to transform a point
Vector3 transformedPoint = currentRotation * new Vector3(1, 0, 0);