Vec3Lerp

Top  Previous  Next

Syntax:

 

Vec3Lerp(VECTOR3 v1, VECTOR3 v2, FLOAT  s), VECTOR3

 

Purpose:

Performs a linear interpolation between two 3D vectors.

 

Parameters:

v1 - First vector

v2 - Second vector

s - Parameter that linearly interpolates between the vectors.

 

Returned value:

The new vector in a VECTOR3 UDT

 

Application:

'take 10 secs to move the object between the start and end points.
newpos = Vec3Lerp(vstart, vend, (timeGetTime() - StartTime) / 10.0)
mesh1.SetPosition(newpos)

 

Additional Info:

This function performs the linear interpolation based on the following formula: Result = V1 + s(V2-V1).