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.
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.
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.
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.