Hi!
I am facing a weird problem. I have a Mouse Look script for a First Person view. When I am working in the Editor everything is working as expected. But when I build everything to a Windows Player and change the resolution, the mouse rotation is slower and more laggy. First I thaught there is a problem with Time.deltaTime, but it seems I made another mistake.
As I am working on a Viewer software, which will be run in Window Mode and where the User can change the resolution on runtime, this is quiet annoying. Here is the code for the Mouse Look (part from a bigger script):
private float rotX = 0.0f;
private float rotY = 0.0f;
private float rotZ = 0.0f;
void Update() {
rotationX = Input.GetAxisRaw("Mouse X") * Time.deltaTime;
rotationY = -Input.GetAxisRaw("Mouse Y") * Time.deltaTime;
}
void FixedUpdate() {
Rotate(rotationY, rotationX, 0.0f, false);
}
private void Rotate(float x, float y, float z, bool firstPerson)
{
rotX += x * mouseSpeed;
rotY += y * mouseSpeed;
rotZ += z * mouseSpeed;
if (firstPerson)
{
rb.transform.Rotate(rotX, rotY, rotZ);
}
else
{
var camTransform = currentCamera.GetComponentInChildren<Camera>().transform;
currentCamera.transform.forward = new Vector3(
camTransform.forward.x,
0.0f,
camTransform.forward.z
);
camTransform.Rotate(rotX, rotY, rotZ);
}
}