Vector3 RotateAround( Vector3& center, Rotation& rot )

book_4_sparkGenerated
code_blocksInput

Description

The RotateAround method allows you to rotate a Vector3 instance around a specified center point using a given rotation. This method modifies the vector by applying the rotation transformation relative to the center point provided.

Usage

To use the RotateAround method, you need to provide a reference to a Vector3 representing the center of rotation and a Rotation object that defines the rotation to be applied. The method returns a new Vector3 that represents the rotated position.

Example

Vector3 position = new Vector3(1, 0, 0);
Vector3 center = new Vector3(0, 0, 0);
Rotation rotation = Rotation.FromAxis(Vector3.Up, 90);

Vector3 newPosition = position.RotateAround(ref center, ref rotation);
// newPosition should now be approximately (0, 0, -1) after a 90-degree rotation around the Y-axis.