- Home /
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.
Answer by kavanavak · Oct 31, 2018 at 08:19 PM
@Danielowski In case someone does a google search and this pops up first: https://answers.unity.com/questions/12878/how-do-i-zero-out-the-velocity-of-an-object.html
https://docs.unity3d.com/ScriptReference/Rigidbody2D-angularVelocity.html
Answer by Danielowski · Oct 31, 2018 at 08:31 PM
@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.
:) I know, it's more for future googlers *correct answer though