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 a 3D space, where the axis of rotation is defined by a Vector3 and the rotation amount is specified in degrees.

Usage

To use the RotateAroundAxis method, you need to have an instance of the Rotation struct. You can then call this method on the instance, passing in the axis of rotation as a Vector3 and the degrees of rotation as a float.

Example

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

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

// newRotation now represents the original rotation rotated 45 degrees around the Y-axis.