- Home /
How do i keep an object from rotating?
Hello. I am trying to make a space game. I want the game object to rotate with the ship in world space, but NEVER rotate in the local space, on its own. basically, the rotations will always be set to zero in the editor.
Answer by petur · Sep 15, 2019 at 05:48 AM
1- First make sure you do need a rigidbody on that gameobject. If not, just remove the rigidbody and be done with.
2- If you are going to fully control your rigidbody from code, but need it to affect other gameobjects, make it kinematic (tick the "is kinematic" checkbox on the rigidbody component.
3- If you need your gameobject's position to be affected by physics, but not it's rotation, tick those "Freeze rotation" checkboxes on the rigidbody.
https://docs.unity3d.com/es/current/Manual/class-Rigidbody.html
Answer by ComputerCables · Sep 14, 2019 at 11:27 PM
So you want to rigidly attached something to the ship? (like a weapon) Just ensure the root object of the ship has the only rigidbody, children can have colliders, but they must not have rigidbodies.
Thanks for your answer. It helped, but the other one helped more, which is why I accepted his. I give you 3 points from the reward user box.
Your answer
Follow this Question
Related Questions
Rotation Speed 1 Answer
Rotate object around local Z axis 1 Answer
Slerp/Rotational Problem Query 1 Answer
Maybe easy to do, but: How? 2 Answers
Combining 2 Rotations: Global and Local 2 Answers