Transform RotateAround( Vector3& center, Rotation& rot )

book_4_sparkGenerated
code_blocksInput

Description

The RotateAround method allows you to rotate a Transform around a specified point in space. This is useful for creating orbital motion or rotating an object around a pivot point.

Usage

To use the RotateAround method, you need to provide a reference to a Vector3 representing the center point around which the rotation will occur, and a Rotation object that defines the rotation to be applied.

The method modifies the Transform instance it is called on, updating its position and rotation to reflect the rotation around the specified center.

Example

// Example of using RotateAround
Transform myTransform = new Transform();
Vector3 centerPoint = new Vector3(0, 0, 0);
Rotation rotation = Rotation.FromAxis(Vector3.Up, 45); // Rotate 45 degrees around the Up axis

// Rotate myTransform around centerPoint by the specified rotation
myTransform.RotateAround(ref centerPoint, ref rotation);

// After this call, myTransform's position and rotation will be updated to reflect the rotation around the centerPoint.