I want a gameobject with a rigidybody2D to not rotate when colliding with something. I tried freezing the z-axis, but then I cannot rotate the rigidbody with code as well. This is necessary, as I sync the rigidbody over the network. When I simply set the rotation after the collison to the rotation before the collison I get a single frame where the object is still affected by the collision. Is there a good way to achieve this?