I am making a space game where I want the player to be able to navigate a 3d map of all the stars. For this I made a simple script that translates the mouse X and Y axis into a change in localEulerAngles. It works perfectly, however when you move the mosue upwards and “flip” upside down, the movement is inverted. This makes total scense of course, but I don;t know how to fix it.
Here is my code
xRot += Input.GetAxis("Mouse X") * xSensitivity;
yRot -= Input.GetAxis("Mouse Y") * ySensitivity;
Vector3 newRot = new Vector3(yRot, xRot, 0);
transform.localEulerAngles = newRot;
Anyone who can help me?
Many thanks!