Rotation RotateAroundAxis( Vector3 axis, float degrees )

book_4_sparkGenerated
code_blocksInput

Description

The RotateAroundAxis method allows you to rotate a Rotation instance around a specified axis by a given number of degrees. This method is useful for applying incremental rotations to an object in 3D space, particularly when you want to rotate around a specific axis.

Usage

To use the RotateAroundAxis method, you need to provide a Vector3 representing the axis of rotation and a float value for the degrees to rotate. The method returns a new Rotation instance that represents the original rotation modified by the specified rotation around the given axis.

Example

// Example of using RotateAroundAxis
Rotation currentRotation = new Rotation();
Vector3 axis = new Vector3(0, 1, 0); // Y-axis
float degrees = 45.0f;

// Rotate the current rotation 45 degrees around the Y-axis
Rotation newRotation = currentRotation.RotateAroundAxis(axis, degrees);