How to get 'real' velocity of an object and not the input velocity?

I have a player controller where the player uses velocity to move using physics. Now if I hit a wall, the input velocity is still the same, but the player stops moving. I need a way to get the player’s velocity (real) when he is running into a wall because I am constantly feeding 25 into the player’s z velocity, but what if the player is on a wall? He is then not moving at all, but the velocity on z still gives 25.

If you set the rigid body’s z velocity to 25, it’s definitely going to be 25 when you try to read it. Make sure you check it before you set it, in whatever script you’re setting it.

Yup, rigidbody.velocity should work. Credit to @nanavatidhruvik