Tuesday, July 12, 2011

How do i rotate an image based on the mouse? JAVA?

Math.atan is in the range of -pi/2 to pi/2, so you can't get the full 360 degrees you need. Try Math.atan2(y_dist, x_dist) or Math.atan2(x_dist, y_dist), as it will give you a range of -pi to pi. Maybe you'll need to change some signs to get it right for your problem.

No comments:

Post a Comment