[QUOTE=Dlaor-guy;25566815][b][url=http://wiki.garrysmod.com/?title=G.LerpAngle]G.LerpAngle [img_thumb]http://wiki.garrysmod.com/favicon.ico[/img_thumb][/url][/b][/QUOTE]
could you give an example on how i would use this to smooth a transition between 2 angles?
[QUOTE=Nevec;25567210][lua]local fraction = ( CurTime() - StartTime ) / Length;
local curAngle = LerpAngle( fraction, startAngle, targetAngle );[/lua][/QUOTE]
That's just what I need, but its outputting unexpected angles, can you please explain what StartTime and Length are? I assume StartTime is the time initiated, but I don't get length.
Thanks for the help so far.
Length is the time interval in which the angle should transition. LerpAngle screws up when fraction goes out of range. Clamp it:
[lua]math.Clamp( fraction, 0, 1 );[/lua]
Thank you Nevec! Took a little tweaking to know where to put the parts but it's all working now! Thanks again!
Sorry, you need to Log In to post a reply to this thread.