Transform RotateAround( Vector3& center, Rotation& rot )

robot_2Generated
code_blocksInput

Description

The RotateAround method allows you to rotate a Transform around a specified center point by a given rotation. 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 of rotation and a Rotation object that defines the rotation to be applied. The method returns a new Transform that represents the result of the rotation.

Example

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

Transform newTransform = currentTransform.RotateAround(ref center, ref rotation);

// newTransform now represents the original transform rotated around the center by the specified rotation.