The Rotation
field of the Transform
struct represents the rotational component of the transform. It defines the orientation of the transform in 3D space.
The Rotation
field of the Transform
struct represents the rotational component of the transform. It defines the orientation of the transform in 3D space.
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 entity or adjusting the orientation of a camera.
// 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; // Applying a new rotation myTransform.Rotation = Rotation.Identity; // Reset to no rotation