# Rotate towards angle - does it not rotate smoothly?

Get help using Construct 2

### » Sun Jan 22, 2017 1:21 am

Hello,

perhaps a little bit of a noobish question, is rotate towards angle supposed to rotate smoothly, rather than instantly?

I want my spawned missile to rotate 90 degrees counter clockwise (missile default angle is 0) smoothly. I thought that 'rotate towards angle' did that but I'm not sure.

Or how would I go about doing this?

Thanks.

- R
B
14
S
7
G
4
Posts: 145
Reputation: 3,610

### » Sun Jan 22, 2017 2:10 am

Well, looks like I managed to get what I want with a little help from this tutorial:

https://www.scirra.com/tutorials/1350/understanding-rotation-and-angles

And how I got it:

It works nicely.
B
14
S
7
G
4
Posts: 145
Reputation: 3,610

### » Sun Jan 22, 2017 5:43 am

Set angle to self.Angle - 10*dt???
Why not just self.Angle - 10 ?
B
37
S
16
G
27
Posts: 779
Reputation: 17,824

### » Sun Jan 22, 2017 5:51 am

Haha, I'm not sure, I just took the example from the tutorial. Is it not necessary? I thought dt was used to make it go smoothly. So it won't change angle instantly but move towards it.
B
14
S
7
G
4
Posts: 145
Reputation: 3,610

### » Sun Jan 22, 2017 6:11 am

Rudi55 wrote:Haha, I'm not sure, I just took the example from the tutorial. Is it not necessary? I thought dt was used to make it go smoothly. So it won't change angle instantly but move towards it.

dt is actually time that passed since you started the layout.
Don't worry. I did not read the manual myself and just learn construct 2 by trial and error looking at the capx examples.
B
37
S
16
G
27
Posts: 779
Reputation: 17,824

### » Sun Jan 22, 2017 8:12 am

MPPlantOfficial wrote:dt is actually time that passed since you started the layout.

Sorry, but wrong.
dt is the time of the current frame/tick, its value is about 0.016 when the game running 60 frames per second.
And sometimes it is critical to multiply the value to the frame time to get frame-rate-independent animations.
It is good to do if you want your game to run smooth even on weaker devices.

Better to read the manual, I found there countless tips and shortcuts to use.
B
64
S
32
G
6
Posts: 126
Reputation: 8,073

### » Sun Jan 22, 2017 8:18 am

MPPlantOfficial wrote:Set angle to self.Angle - 10*dt???
Why not just self.Angle - 10 ?

dt is the time that passed between the current tick and the former tick, by setting every tick the angle to self.angle - 10* dt, you make it change every tick with a speed of 10*dt degrees per frame, which translates to an average speed of 10 degrees per seconds regardless of the framerate.

if it was just self.angle-10 then it would change not only faster, but alsodepending on the framerate (twice as fast on a screen with a 120Hz refresh rate compared to a 60 Hz one, also would be slower if the game was having a hard time rendering every frame on a regular basis)

hope that helps
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

### » Sun Jan 22, 2017 8:36 am

Aphrodite wrote:
MPPlantOfficial wrote:Set angle to self.Angle - 10*dt???
Why not just self.Angle - 10 ?

dt is the time that passed between the current tick and the former tick, by setting every tick the angle to self.angle - 10* dt, you make it change every tick with a speed of 10*dt degrees per frame, which translates to an average speed of 10 degrees per seconds regardless of the framerate.

if it was just self.angle-10 then it would change not only faster, but alsodepending on the framerate (twice as fast on a screen with a 120Hz refresh rate compared to a 60 Hz one, also would be slower if the game was having a hard time rendering every frame on a regular basis)

hope that helps

Oh I see. Sorry guys. I confuse dt with time
B
37
S
16
G
27
Posts: 779
Reputation: 17,824