Jittery movement with Rigidbody velocity

Hello, i’m trying to make a viewmodel bobbing script, but the results look kinda jittery…


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GunBob : MonoBehaviour
{
    [SerializeField] AnimationCurve SwayHorizontal, SwayVertical;
    [SerializeField] Vector3 Offset;
    [SerializeField] float Frequency, AmplitudeHorizontal, AmplitudeVertical;
    [SerializeField] PlayerMotor Motor;
    void LateUpdate()
    {
        Frequency = Motor.rb.velocity.magnitude / Motor.MoveSpeed;
        
        Vector3 SwayVector = new Vector3
        (SwayHorizontal.Evaluate(Time.time * Frequency) * AmplitudeHorizontal,
        SwayVertical.Evaluate(Time.time * Frequency) * AmplitudeVertical,
        0);

        transform.localPosition = Offset + SwayVector;
    }
}


The code is really simple.
I’m trying to update the sway frequency according to the rigidbody’s velocity. MoveSpeed is a variable that doesn’t really change much, and i’ve tried to use GetComponent().velocity in place of motor.rb.velocity but it doesn’t solve anything. Would be grateful if someone could help me with this little nuisance.