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
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

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
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

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
90
S
30
G
24
Posts: 3,189
Reputation: 32,400


Return to How do I....?

Who is online

Users browsing this forum: fredriksthlm, MPPlantOfficial, Yahoo [Bot] and 28 guests