Change rigidbody's velocity on one axis, c#

Hi,

I have a problem changing the direction of the velocity on a rigidbody in just one axis after force has been put upon it. The problem is kind of like in this thread below, but I would need an answer in c#. I use a torque to rotate the object and would like the direction of the velocity to follow the rotation of the object.

Thank you!

Well, I just managed myself. Seems quite logical now, when I know.

This would rotate around the Y-axis:

	Vector3 rVel = rigidbody.velocity;
	rVel.x = rVel.magnitude * transform.forward.normalized.x;
	rVel.z = rVel.magnitude * transform.forward.normalized.z;
	rigidbody.velocity = rVel;