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

Author Topic: Need help rotating a sprite in Box2D  (Read 2724 times)

0 Members and 1 Guest are viewing this topic.

recharge330

  • Newbie
  • *
  • Posts: 2
    • View Profile
Need help rotating a sprite in Box2D
« on: February 05, 2011, 09:08:01 pm »
I been looking around but I can't figure out how to match the rotation of the sprite with the body in Box2D. Whenever I try the sprite will just continue to spin after the object has stopped moving. I don't know enough about radians and angles to try to figure out how to stop it from passing the correct angle. Any help would be much appreciated.

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Need help rotating a sprite in Box2D
« Reply #1 on: February 05, 2011, 09:18:15 pm »
http://www.sfml-dev.org/forum/viewtopic.php?t=205
Looks like the answer you're looking for. ;)

In Laurent's example, 1.158f should be your body's rotation.
(and "return Deg" should be "return Rad")

recharge330

  • Newbie
  • *
  • Posts: 2
    • View Profile
Need help rotating a sprite in Box2D
« Reply #2 on: February 05, 2011, 09:33:17 pm »
Thanks, I was using rotate instead of SetRotation. It works perfectly now.