Description
The Rotation.FromAxis
method creates a Rotation
instance representing a rotation around a specified axis by a given number of degrees. This method is useful for generating rotations based on an arbitrary axis, which is defined by a Vector3
direction.
Usage
To use the FromAxis
method, provide a Vector3
representing the axis of rotation and a float
value for the degrees of rotation. The method returns a Rotation
object that can be used to apply the rotation to objects in the scene.
Example
// Example of using Rotation.FromAxis
Vector3 axis = new Vector3(0, 1, 0); // Y-axis
float degrees = 90.0f; // Rotate 90 degrees
Rotation rotation = Rotation.FromAxis(axis, degrees);
// Apply this rotation to a game object
GameObject myObject = new GameObject();
myObject.Transform.Rotation = rotation;