The above code is used to rotate my player object to face the mouse position.
It works only as long as my mouse is within the positive X quadrants relative to the player’s local space.
E.g. the mouse must be above the imaginary horizontal line which intersects with my player object.
After much investigation I realised that mouseToAxis provides the angle between the Position Vector of the Mouse to the X-Axis, both the positive and negative Y-Axis gives a result of 90 degrees. However I want the negative Y-axis to give a bearing of 180+90 instead of just 90.
Does anyone know how I could accomplish this either mathematically or through some Unity interface? Thanks in advance!
This simply makes the player object rotate slowly towards the mouse position. Some parts might be a little unnecessary so anyone who knows his vector math can probably optimize this quite a bit.