Garry's Mod Wiki

LerpVector

Vector LerpVector( number fraction, Vector from, Vector to )

Description

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

Arguments

1 number fraction
Fraction ranging from 0 to 1
2 Vector from
The initial Vector
3 Vector to
The desired Vector

Returns

1 Vector
The lerped vector.

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()

Page Links


Special Pages


Wikis

?

Render Time: 22ms

Session 0
DB GetPage 3
Generate Html 1
SaveChanges 10
Render Body 0
Render Sidebar 6