rigidbody.velocity
is a vector - its direction defines direction of movement and its length defines speed of movement. Using these properties, you can:
float cachedLength = rigidbody.velocity.magnitude;
).rigidbody.velocity = rigidbody.velocity.normalized * cachedLength;
This way, you accept change in direction, but not in legth of the vector.