Smooth rotation

  • Hi,

    I'm new to construct and just finish the ghost hunter tutorial.

    I noticed in the game that monster>set angle toward player .X & .Y makes the monster to flip suddenly & not rotate to the player's position, not like the player>set angle toward mouse that follow the cursor 360 smoothly.

    How do i make the monster turn smoothly & maybe can edit their turning speed, etc?

    Thank you

  • I made a small example to show you how smooth rotation can be done:

    db.tt/dJ3uUEcg

    It's a little bit more complicated than it should be thanks to the way angles work, and there's a problem with it, which you'll notice quickly: under certain conditions, the arrow will rotate in the opposite direction to get to the mouse, but I don't know enough about the angles system to work around that. Maybe someone else can take a look at that?

    Anyways, you can edit the "Arrow | Set angle to Arrow.Angle +/- 1" event to change the turning speed. Changing 1 to 5 for example will be a lot faster.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • under certain conditions, the arrow will rotate in the opposite direction to get to the mouse, but I don't know enough about the angles system to work around that. Maybe someone else can take a look at that?

    Oooh man I've seen a fix to that before, I just can't remember what it was, but it was pretty damn simple

  • Probably Yann's anglelerp emulation.

  • Thanks, i'll try & see if i can fix it.

    But the stuff posted abit too advance for me :D

  • All you need to do is use the 'rotate toward...' actions instead of 'set angle'.

  • All you need to do is use the 'rotate toward...' actions instead of 'set angle'.

    Wow... I never saw that. <img src="smileys/smiley36.gif" border="0" align="middle" />

    Good thing I never had to use this in an actual game or I'd be pretty mad at myself!

  • Thank you, "rotate toward..." works fine :D

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