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 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 angle in degrees as a float
.
For example, if you want to rotate an object around the Y-axis by 45 degrees, you would pass Vector3.Up
as the axis and 45.0f
as the degrees.
Example
// Create a Rotation instance
Rotation rotation = Rotation.Identity;
// Define the axis of rotation (e.g., Y-axis)
Vector3 axis = Vector3.Up;
// Define the degrees to rotate
float degrees = 45.0f;
// Rotate the rotation around the specified axis
Rotation newRotation = rotation.RotateAroundAxis(axis, degrees);
// newRotation now represents the original rotation rotated 45 degrees around the Y-axis.