How can I fix my sprite being rotated 90 degrees more than toward the mouse?
Posted by: Evan Walsh on 08/21/2015 | Add Revision
I am trying to get a Sprite in LibGDX to look at the player's mouse. Here's the code I have (mind you, I am using JRuby):
target = mouse_position.sub(spatial.position) rotation = MathUtils.atan2(target.y, target.x) spatial.rotation = rotation * MathUtils.radiansToDegrees
This is definitely doing something, but it's not completely correct. Here's a GIF of what it looks like in action:
Where am I going wrong?