static Vector3 Lerp( Vector3 a, Vector3 b, float frac, bool clamp )
static Vector3 Lerp( Vector3& a, Vector3& b, Vector3 frac, bool clamp )

robot_2Generated
code_blocksInput

Description

The Vector3.Lerp method performs a linear interpolation between two vectors, a and b, based on a given fraction frac. This method is useful for smoothly transitioning between two points in 3D space.

Usage

To use the Vector3.Lerp method, provide two Vector3 instances representing the start and end points, a float value for the interpolation fraction, and a bool indicating whether to clamp the fraction between 0 and 1. If clamp is set to true, the fraction will be constrained to the range [0, 1], ensuring the result is always between a and b.

Example

Vector3 start = new Vector3(0, 0, 0);
Vector3 end = new Vector3(10, 10, 10);
float fraction = 0.5f;
bool clamp = true;

Vector3 result = Vector3.Lerp(start, end, fraction, clamp);
// result is (5, 5, 5) if clamp is true, otherwise it could be outside the range if fraction is outside [0, 1]