1
General / Angle between two vectors
« on: July 16, 2013, 09:37:22 pm »
I have been trying out different methods all day to calculate the angle between 2 vectors. I've browsed countless forums and read way too many stackoverflow questions. No matter what method I implement I keep getting the same result.
The angle I'm getting is only good in the bottom right quadrant of the player, and is only exactly correct at 45 degrees.
I've tried the dot product way with acos, I've tried the atan2 method with delta X and delta Y. I just can't seem to get a working function.
The goal is to be able to aim a bullet from the player to the mouse.
Does anyone have a function that works to do this?
The angle I'm getting is only good in the bottom right quadrant of the player, and is only exactly correct at 45 degrees.
I've tried the dot product way with acos, I've tried the atan2 method with delta X and delta Y. I just can't seem to get a working function.
The goal is to be able to aim a bullet from the player to the mouse.
Does anyone have a function that works to do this?