LerpVector

From Garry's Mod
Jump to: navigation, search
 LerpVector( )

Contents

Description

Linear interpolation between two vectors. It is commonly used to smooth movement between two vectors.

Arguments

number fraction

Fraction ranging from 0 to 1

Arguments

Vector from

The initial Vector

Arguments

Vector to

The desired Vector

Returns

Vector

The lerped vector.

Examples

Example

Get the middle point (50%) between two vectors.

local output = LerpVector( 0.5, Vector( 0, 0, 100 ), Vector( 0, 0, 200 ) )

Output:

Vector( 0, 0, 150 )

If you do it each frame to smooth positions, you should couple it with FrameTime()

Personal tools
Navigation