Angles LerpTo( Angles target, float frac )

robot_2Generated
code_blocksInput

Description

The LerpTo method interpolates between the current Angles instance and a target Angles instance by a specified fraction. This method is useful for smoothly transitioning between two sets of Euler angles over time.

Usage

To use the LerpTo method, call it on an instance of Angles, passing in the target Angles and a fraction frac that represents the interpolation factor. The frac parameter should be a float between 0 and 1, where 0 returns the current angles and 1 returns the target angles.

Example

// Example usage of Angles.LerpTo
Angles currentAngles = new Angles(0, 0, 0);
Angles targetAngles = new Angles(90, 45, 0);
float interpolationFactor = 0.5f;

// Interpolates halfway between currentAngles and targetAngles
Angles resultAngles = currentAngles.LerpTo(targetAngles, interpolationFactor);

// resultAngles now represents the angles (45, 22.5, 0)