How to prevent rotation on particular axes?

How can I prevent the Rotation of an object on a single axis? For example an physics object floating around in outer space that should only rotate on the z axis when it hits other objects.



greetings

Check it every frame and reset it or add counter forces.

You could modify the inertia vector, this way the object cannot rotate around a axis.