Reset Rigidbody2D rotation after collision

Hi, everybody!

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?

Kind regards.

In case someone does a google search and this pops up first: How do I zero out the velocity of an object? - Questions & Answers - Unity Discussions

@kavanavak Ha dude, this was more than a year ago. I don’t even know which project I was working on with that problem anymore.