I was checking out the new input system over the weekend, I’m a big fan so far of the features but I was wondering what the correct way to process the callback for mouse delta is.
I’ve tried this:
private void Update()
{
transform.rotation = Quaternion.Euler(_rotation);
}
private void OnLook(InputAction.CallbackContext context)
{
Vector2 lookValue = context.ReadValue<Vector2>();
_rotation.x += -lookValue.y * 0.022f * _sensitivity;
_rotation.y += lookValue.x * 0.022f * _sensitivity;
}
And also this:
private void Update()
{
_rotation.x += -_lookValue.y * 0.022f * _sensitivity;
_rotation.y += _lookValue.x * 0.022f * _sensitivity;
transform.rotation = Quaternion.Euler(_rotation);
}
private void OnLook(InputAction.CallbackContext context)
{
_lookValue = context.ReadValue<Vector2>();
}
I have noticed that I receive several updates to the mouse delta per frame, so it seems like the first way is the correct manner to process the input. However, I was expecting this function to create a similar look speed to cs:go (0.022 is the constant m_yaw value in cs:go) and the second function seems to get closer to the expected result (although it is still a little faster). What units is the mouse delta returned in and what is the correct way to process it if I would want to create a similar sensitivity to source engine games? Thanks in advance for any help!