Garry's Mod Wiki

Garry's Mod Wiki

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

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...