(Closed) Mouse delta , fps independent

Hi there! Got a problem when activating vsync the character and camera often over shot probably due to the rotation not being fps independent, using the legacy input system dont cause this problem so i suppose it the way i use the new system that is wrong.

  • The FixedTimestep is set to 1/60
  • I dont use Time.FixedDeltaTime or Time.DeltaTime because i use smoothDamp

RotatorInput class :

using Sirenix.OdinInspector;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class RotatorInputs : IVector2Provider
{
    private CameraRotator cameraRotator;
    private CharacterRotator characterRotator;

    [SerializeField, Range(0,1f)] private float xAxisSensitivity = 0.5f;
    [SerializeField, Range(0, 1f)] private float yAxisSensitivity = 0.5f;

    [SerializeField, ReadOnly] Vector2 mouseDelta;
    public void Ini(PlayerInputs playerInputs , CameraRotator cameraRotator , CharacterRotator characterRotator)
    {
        this.cameraRotator = cameraRotator;
        this.characterRotator = characterRotator;

        cameraRotator.axisProvider = this;
        characterRotator.axisProvider = this;

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;

        //TO FIX using the new inputs system has weird behavior on low fps (not fps independant)
        playerInputs.CameraAndRotation.MouseDelta.performed += context => mouseDelta = new Vector2(context.ReadValue<Vector2>().x * xAxisSensitivity, context.ReadValue<Vector2>().y * yAxisSensitivity);
        playerInputs.CameraAndRotation.MouseDelta.canceled += context => mouseDelta = Vector2.zero;
    }


    public Vector2 GetVector2()
    {
        //Using the legacy fix the problem
        //mouseDelta = new Vector2(Input.GetAxis("MouseX") * xAxisSensitivity, Input.GetAxis("MouseY") * yAxisSensitivity);
        return mouseDelta;
    }
}

CharacterRotator class :

using Sirenix.OdinInspector;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(Rigidbody))]
public class CharacterRotator : SerializedMonoBehaviour
{
    public IVector2Provider axisProvider;

    public bool canRotate = true;

    private float rotY;
    private float targetRotY;
    private float rotYVelocity;

    public float yAxisSpeed = 5f;
    public float rotYSmoothTime = 0.05f;

    private Rigidbody rigidbody;

    private void Start()
    {
        rigidbody = GetComponent<Rigidbody>();
    }

    private void Update()
    {
        if (axisProvider == null || canRotate == false)
        {
            return;
        }

        UpdateAxis(axisProvider.GetVector2().x);
    }

    private void FixedUpdate()
    {
        Quaternion deltaRot = Quaternion.Euler(new Vector3(0, rotY, 0));

        rigidbody.MoveRotation(deltaRot);
    }
    public void UpdateAxis(float axisY)
    {
        //Rotation on Y axis
        targetRotY += axisY * yAxisSpeed;
        rotY = Mathf.SmoothDamp(rotY, targetRotY, ref rotYVelocity, rotYSmoothTime);
    }
}

Nevermind updated to 0.9 has seem to fix the problem