The LerpTo
method interpolates between the current rotation and a target rotation by a specified fraction. This method is useful for smoothly transitioning from one rotation to another over time.
The LerpTo
method interpolates between the current rotation and a target rotation by a specified fraction. This method is useful for smoothly transitioning from one rotation to another over time.
To use the LerpTo
method, call it on an instance of the Rotation
struct, passing in the target rotation, the interpolation fraction, and a boolean indicating whether to clamp the result.
target
: The target Rotation
to interpolate towards.frac
: A float
representing the interpolation fraction. A value of 0 returns the current rotation, while a value of 1 returns the target rotation.clamp
: A bool
indicating whether to clamp the interpolation fraction between 0 and 1.// Example of using LerpTo Rotation currentRotation = Rotation.Identity; Rotation targetRotation = Rotation.FromAxis(Vector3.Up, 90); float interpolationFraction = 0.5f; bool shouldClamp = true; Rotation resultRotation = currentRotation.LerpTo(targetRotation, interpolationFraction, shouldClamp); // resultRotation is now halfway between currentRotation and targetRotation.