How do I Determine Which Direction to Rotate in a Circle

0 favourites
  • 3 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • I need the logic how to calculate to which direction my object need to turn, clockwise/counterclockwise in the most shortest angle distance to a destination in a circle.

    Let me explain.

    Let's say in a circle, my object is at 20degree, my destination is at 270 degree.

    Calculating the shortest angle distance is easy.

    AngleDistance1 = 270-20 =250 degree.

    AngleDistance2 = 360-250 =110 degree.

    Then I compare AngleDistance1 and 2. The smallest result is the shortest way.

    But then I don't know how to calculate/determince, to which direction should my object turn.

    Should it turn 110degree clockwise or counterclockwise. By seeing is easy to say turn CW or CCW, but without eyes and only numbers, how?

    I need help on this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In Construct 2 angles are calculated clockwise. At 0 degrees your sprite will be facing right, 180 degrees it will be facing left and 90 degrees it will be facing down etc. What this means is, if the angle you are turning toward is less than 180 degrees away, you would want to rotate clockwise. If it is more than 180 degrees, you would want to rotate counter clockwise. At exactly 180 degrees, it doesn't matter.

  • Make sense. Thank you.

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