- Home /
Lock ALL z-axis of project
I found that when I'm moving a character in a 2d world to a wall, and keep moving towards the wall, that both the player and the wall rotate slightly on the z-axis making player stutter left and right.
Now I've seen somewhere that you can lock all z-axis' but I can't for the life of me remember how it was done.
So, in short: How do I lock/freeze all z-axis' of all objects(and objects to come!)
Answer by JuanGomez · Jan 27, 2014 at 12:09 PM
Assuming you are using Rigidbody or Rigidbody2D components both of them have the option. You can select it from the editor.
Here is the access through scripting:
http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-freezeRotation.html
http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody2D-fixedAngle.html
On the other hand you cannot freeze them globally with the build-in tools (I think it would be bad idea anyway)
Cheers :)
Answer by Headworker · Jan 27, 2014 at 12:46 PM
One (a bit hacky) approach would be to just surpress rotation by setting Angular Drag to a really high number (like 1000000).
Your answer
Follow this Question
Related Questions
Why does the player keep pointing in a specific direction after moving? 0 Answers
Constrain axis of isometric camera ("vertical" only) 0 Answers
Rotating a player object without rotating the axis 0 Answers
Can't get character to Jump on the Y Axis (C#) 2 Answers
Clamping movement range on X-axis 0 Answers