Smooth Rotation with Acceleration & Decceleration

Get help using Construct 2

Post » Mon Oct 01, 2012 2:47 pm

Hi, I've been playing with Construct 2 and I need some help with my math.

In my game You tell a sprite to rotate to a specific angle.

When the sprite starts it speeds up until it reaches a max speed then slows down so it will not overshoot the desired angle.

I've tried anglelerp but it starts of instantly then slows down, so that doesn't work.

I think if I knew how to get the current turn speed and know how many degrees it would turn before it slows down to zero, then I could do the rest.

So if it's turn speed increases by 1/sec:
(Both these values start at 0)
Acceleration = 2
TurnSpeed AngleTurnedTo
2          2
4          6
6          12
8          20
10        30
12        42
14        56
16        72
18        90
20        110

So if I could know the equation for this. I think I could make it work.

Any help?
Follow me on Twitter @evgLabs
B
33
S
14
G
4
Posts: 251
Reputation: 4,049

Post » Mon Oct 01, 2012 8:31 pm

If the start and end velocity is zero then it can be done by accelerating the first half of motion and decelerating the second half by the same amount.

Here is a capx:
http://dl.dropbox.com/u/5426011/examples14/accel_deccel.capx
B
79
S
24
G
54
Posts: 4,753
Reputation: 40,769

Post » Mon Oct 01, 2012 10:41 pm

Thanks, but the start velocity is not always 0 the player could change when the sprite is turning.
Follow me on Twitter @evgLabs
B
33
S
14
G
4
Posts: 251
Reputation: 4,049

Post » Tue Oct 02, 2012 1:09 am

Here is how I solved it before in CC:
http://dl.dropbox.com/u/5426011/examples14/turret2.capx

(velocity^2)/(2*acceleration) is the stopping distance.
B
79
S
24
G
54
Posts: 4,753
Reputation: 40,769


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests