SFML community forums

Help => Graphics => Topic started by: recharge330 on February 05, 2011, 09:08:01 pm

Title: Need help rotating a sprite in Box2D
Post by: recharge330 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.
Title: Need help rotating a sprite in Box2D
Post by: G. 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")
Title: Need help rotating a sprite in Box2D
Post by: recharge330 on February 05, 2011, 09:33:17 pm
Thanks, I was using rotate instead of SetRotation. It works perfectly now.