Garry's Mod Wiki

LerpAngle

Angle LerpAngle( number ratio, Angle angleStart, Angle angleEnd )

Description

Returns point between first and second angle using given fraction and linear interpolation

Arguments

1 number ratio
Ratio of progress through values
2 Angle angleStart
Angle to begin from
3 Angle angleEnd
Angle to end at

Returns

1 Angle
angle

Example

Turns an entity 180 degrees uses lerp over ten seconds

local startAngle = Angle(0, 0, 0) local endAngle = Angle(0, 180, 0) local ratio = 0 timer.Create("Turn", 0.1, 10, function() ratio = ratio + 0.1 entity:SetAngles(Lerp(ratio, startAngle, endAngle)) end)

Page Links


Special Pages


Wikis

?

Render Time: 39ms

Session 0
DB GetPage 4
Generate Html 12
SaveChanges 15
Render Body 0
Render Sidebar 7