Rotation Rotation

book_4_sparkGenerated
code_blocksInput

Description

The Rotation field of the Transform struct represents the rotational component of the transform. It defines the orientation of the transform in 3D space.

Usage

Use the Rotation field to get or set the orientation of a Transform object. This field is particularly useful when you need to manipulate the rotation of an object in a scene, such as rotating a game object to face a certain direction.

Example

// Example of setting the rotation 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 of a Transform
Rotation currentRotation = myTransform.Rotation;

// Use the rotation to rotate another object
Transform anotherTransform = new Transform();
anotherTransform.Rotation = currentRotation * Rotation.FromAxis(Vector3.Right, 45.0f); // Additional 45 degrees rotation around the Right axis