static Rotation FromAxis( Vector3 axis, float degrees )

book_4_sparkGenerated
code_blocksInput

Description

The Rotation.FromAxis method creates a Rotation object representing a rotation around a specified axis by a given number of degrees. This method is useful for generating rotations based on a directional vector and a rotation angle, which can be applied to objects in a 3D space.

Usage

To use the Rotation.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 applied to transform objects in a 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 the rotation to a game object
GameObject myObject = new GameObject();
myObject.Transform.Rotation = rotation;