X and Y axis rotation bug


As you can see in the video I linked below, as I am stuck in the corner I begin to rotate out in the X and Y directions. It seems as though once the rocket gets hooked on an object, the restraint on X or Y rotation no longer applies.

The obstacles in my scene have rigid bodies and “Is Kinematic” is checked on for them. I have done this because I was playing around with implementing a momentum check on collision as an added feature. I am wondering if this occurs for anyone else, or if perhaps this bug is a result of the changes I have made?

The problem is with the initial rotation code which uses simple rigidBody.freezeRotation.

To solve this small problem I’ve written a simple method which you should use instead of rigidBody.freezeRotation.

Pastebin code.