For an application in the cloud(Camera movement doesnt work in the cloud, after some research and testing I found out it doesn’t detect Input.GetAxis) I was asked to make the camera work in a different way.
The program could not register mouse movement, but could see the mouse position, so I tried using the old mouse position vs the new position to see if the mouse went left/right/up/down(This seemed like a pretty solid solution)
But the problem I’m having in this solution is that the camera “tilts”, I would think I would only go left/right/up/down, but somehow my camera sometimes slightly tilts/rotates when moving it around.
Any idea how to stop this from happening?
void Update()
{
mouseY = Input.mousePosition.y;
mouseX = Input.mousePosition.x;
if (Input.GetKey(KeyCode.Mouse1) & (mouseY > mouseY2))
{
Camera.main.transform.Rotate(new Vector3(-2, 0, 0));
}
if (Input.GetKey(KeyCode.Mouse1) & (mouseY < mouseY2))
{
Camera.main.transform.Rotate(new Vector3(2, 0, 0));
}
if (Input.GetKey(KeyCode.Mouse1) & (mouseX > mouseX2))
{
Camera.main.transform.Rotate(new Vector3(0, 2, 0));
}
if (Input.GetKey(KeyCode.Mouse1) & (mouseX < mouseX2))
{
Camera.main.transform.Rotate(new Vector3(0, -2, 0));
}
mouseY2 = Input.mousePosition.y;
mouseX2 = Input.mousePosition.x;
}