take velocity of player unity code example
Example: unity how to get player velocity
var vel = rigidbody.velocity; //to get a Vector3 representation of the velocityspeed = vel.magnitude; // to get magnitude
var vel = rigidbody.velocity; //to get a Vector3 representation of the velocityspeed = vel.magnitude; // to get magnitude