How do I lerp consequently clockwise or ccw?

Get help using Construct 2

Post » Wed Feb 04, 2015 12:39 am

Hi guys,

I have an issue with lerping rotations. When I let the rotation ease with lerp from 0 to 180 it rotates clockwise, when I do the same from 180 to 360, it changes to counterclockwise, as if I used 180 to 0. I tried to use anglelerp, but that did not help as expected.

That means I need the sprite spinning cw or ccw continuously, not swinging back and forth.

Please take a look. Thanks in advance!
You do not have the required permissions to view the files attached to this post.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Wed Feb 04, 2015 1:34 am

A sprite's angle value is automatically wrapped to keep it between 0 and 360. A way around this is to store and update a virtual angle in an instance variable, then set the actual angle to this value. I've modified your example to show this working.
You do not have the required permissions to view the files attached to this post.
Moderator
B
104
S
39
G
19
Posts: 1,584
Reputation: 18,167

Post » Wed Feb 04, 2015 2:08 pm

It seems to keep it 0 to < 360 (like 359), since he accounts 360 for 0 thus not even managing a 360 turn /:

> @linkman2004 : did not know about that trick. Thanks a lot, that's exactly what I needed.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Tue Feb 17, 2015 3:50 pm

@linkman2004 thank you! I was doing the same thing with anglelerp and it wasn't working... this saved me!

by any chance.. I have yet to see how anglelerp is to be used.. does anyone know?
B
59
S
15
G
7
Posts: 939
Reputation: 8,825


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, jeffige, jpstudio and 1 guest