i am working on camera rotations based on mouseInput and i want it to have consistent sensitivity across all framerates. According to the unity documentation, the Input.GetAxis should be inherently framerate independent for the mouse movement.
What I am finding is that when i use the code below and change the framerate from 200+ to 30, the Input.GetAxis is returning very different outputs. For 200+ fps the GetAxis is low around like 2-5 where for 30 fps it is returning around 10-15 for the same mouse movements. Its causes a very drastic sensitivity difference in-game. Am i missing something? Thanks
public Rigidbody _playerRigidBody;
private Vector2 _lookInput;
private void Start()
{
//Application.targetFrameRate = 30;
}
private void Update()
{
_lookInput.x = Input.GetAxis("Mouse X");
}
void FixedUpdate()
{
var sensitivity = 300f;
var newPlayerRotation = _playerRigidBody.rotation * Quaternion.Euler(_lookInput.x * sensitivity * Vector3.up * Time.deltaTime);
_playerRigidBody.MoveRotation(newPlayerRotation);
}
}
I have tested everything in this little function and the only thing that causes the issue is the Input.GetAxis. Its inconsistent. Any ideas or solutions or workarounds?