My player is going to have a rotation control based on the mouse position. The player is always in the center of the screen. What I need to do is get the rotation around the center of the screen(the player) . From there I will pipe that to a function which sets the player’s heading.
I checked “Hello Picking”, but /i still come across the problem of getting the rotation from the coordinates.
I mean… you have rectangular coordinates and you want an angle. How much clearer does the javadoc need to be:
“Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).”
Pass in your rectangular coordinates… get an angle. I can’t be any clearer without writing the code for you… but my contracting rates are quite steep.
I think you need to draw on a piece of paper. Draw a screen shaped box. Put a big dot in the middle. Write down what the rough x,y of that is.
Put some other random dots on the rectangle and work out roughly what their CENTER RELATIVE COORDINATES should look like. Make sure to do this in at least all four quadrants. Note, for example that the lower left quadrant would be negative numbers and not giant positive ones.
(Hint: your math is exactly the opposite of what it should be.)