Rigid body + RootMotion : Speed issues when lag occurs

Hello!
I created a rigid body controller that takes velocity from the animation delta position so that the movement speed syncs up with the animations.
However, Im having issues whenever the game drops frames. The character will move forward by a lot and it has me worried that it’ll be unpleasant whenever the game is played on lower end computers. Here’s the movement code:

//called through OnAnimatorMove()
void UpdateControllerTransform() {
            rigid.drag = 0;
            Vector3 v = anim.deltaPosition / Time.deltaTime;
            if (rigid.velocity != null && !float.IsNaN(v.x))
            {
                v.y = 0;
                rigid.velocity = v;
            }
        }

Maybe there’s something that im missing or an easier solution to my problem? Im also not sure if all of those ifs are really needed.
Would love some help here. Thanks in advance!

Time.deltaTime is the per-frame time so you’re making your velocity frame-rate dependent. That’s why there’s the fixed-update time which is Time.fixedDeltaTime.