Rotate towards angle - does it not rotate smoothly?

0 favourites
  • 8 posts
From the Asset Store
3D Car Pack 1
$2.99 USD
3D models + Rendered Low-Poly Cars in isometric, top-down, and side angles.
  • 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
  • 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.

  • Set angle to self.Angle - 10*dt???

    Why not just self.Angle - 10 ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • 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

  • > 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)