static Rotation Lerp( Rotation a, Rotation b, float frac, bool clamp )

book_4_sparkGenerated
code_blocksInput

Description

The Rotation.Lerp method performs a linear interpolation between two rotations, a and b, based on a specified fraction frac. This method is useful for smoothly transitioning between two orientations over time. The clamp parameter determines whether the interpolation fraction should be clamped between 0 and 1.

Usage

To use the Rotation.Lerp method, provide two Rotation objects representing the start and end rotations, a float value for the interpolation fraction, and a bool to indicate if the fraction should be clamped. The method returns a new Rotation that is the result of the interpolation.

Example

// Example of using Rotation.Lerp
Rotation startRotation = Rotation.FromAxis(Vector3.Up, 0);
Rotation endRotation = Rotation.FromAxis(Vector3.Up, 90);
float fraction = 0.5f;
bool clamp = true;

Rotation result = Rotation.Lerp(startRotation, endRotation, fraction, clamp);
// result now represents a rotation halfway between startRotation and endRotation.