Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Rotation of a sprite  (Read 1245 times)

0 Members and 1 Guest are viewing this topic.

SamuelGHOST

  • Newbie
  • *
  • Posts: 5
    • View Profile
Rotation of a sprite
« on: November 24, 2018, 06:56:59 pm »
Let's say that I have current and next coordinations of a sprite. How do I rotate sprite towards the position of the next coordinations?

ZeroZ30o

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: Rotation of a sprite
« Reply #1 on: November 24, 2018, 07:43:34 pm »
A rotation does not change the position (coordinates) of a sprite's center of rotation (which is what you actually "move"), so I don't know what you mean.

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: Rotation of a sprite
« Reply #2 on: November 25, 2018, 09:47:30 am »
With MATH  ;D.  Calculate the angle using std::atan2().