unity use velocity in update code example
Example 1: unity how to set rigidbody velocity
Vector3 velocity = new Vector3(10f/*x*/, 10f/*y*/, 10f/*z*/);
GetComponent<Rigidbody>().velocity = velocity;
Example 2: unity how to get player velocity
var vel = rigidbody.velocity; //to get a Vector3 representation of the velocityspeed = vel.magnitude; // to get magnitude