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 an arbitrary axis, which is defined by a Vector3 parameter.

Usage

To use the FromAxis method, provide a Vector3 that represents 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(1, 0, 0); // Rotate around the x-axis
float degrees = 90.0f; // Rotate by 90 degrees
Rotation rotation = Rotation.FromAxis(axis, degrees);

// Apply the rotation to a game object
GameObject myObject = new GameObject();
myObject.Transform.Rotation = rotation;