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

This function is not meant to be used with constant value in the first argument, if you're dealing with animation! Use a value that changes over time

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: 39ms

DB GetPage 3
Generate Html 8
SaveChanges (1) 11
Render Body 0
Render Sidebar 14