Problem with angle lerping

Get help using Construct 2

Post » Mon Feb 20, 2012 11:34 pm

I'm using Yann's great Angle lerping technique to rotate my layer, according to the angle of the player.



However, whenever you go around 360 degrees, the lerp suddenly decides to rotate the other way, completely disorienting (and scaring :D ) the player, most likely killing them.

Any way of accomplishing this without the weird side-effect?
I tried playing around with/adding the %360's, but it doesn't seem to have much effect.

Thanks!
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,644

Post » Tue Feb 21, 2012 1:28 am

lerp() doesn't work with angles, because angles are cyclical but lerp is linear. Classic had anglelerp(), I'll see if I can add that.
Scirra Founder
B
382
S
223
G
86
Posts: 23,994
Reputation: 189,755

Post » Tue Feb 21, 2012 1:44 am

@Ashley, anglelerp would be great. This code is a workaround that allows angle lerping currently for the most part, however has the bug I mentioned.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,644


Return to How do I....?

Who is online

Users browsing this forum: DaniellMesquito, repkino, SnipG and 6 guests