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 and getting the Rotation field of a Transform
// Create a new Transform instance
Transform myTransform = new Transform();
// Set the rotation of the transform
myTransform.Rotation = Rotation.FromAxis(Vector3.Up, 45.0f); // Rotate 45 degrees around the Up axis
// Access the rotation of the transform
Rotation currentRotation = myTransform.Rotation;
// Output the current rotation
// Note: Use appropriate methods to display or log the rotation, as Console.WriteLine is not recommended in this context.