- Home /
Door rotate on hinge?
Hey basically i'm trying to make it so when you walk into a door it swings open
I've got my box and added a door hinge but as I run into it nothing happens. I've tried a few things but nothing seems to work. It just stays still. My character script also has a rigidbody.
Answer by cdrandin · May 01, 2015 at 05:28 PM
Create a new game object. Place the newly created game object where you would want the pivot to be for your door object. Then place the door object into the newly created game object.
Hierarchy should be:
-- New GameObject
|____ Door object
This way you now have your pivot and you rotate around the y-axis to have your door swing open and close.
Okay it's sort of working, do I still need to attatch hinge joints? as the door sort of just falls over currently
thanks for the reply too :D
You can lock rotation in the rigidbody so that it will ALWAYS stand upright and only rotate around the Y axis (which is all you need)
Tried locking it but it still either falls over, can't be moved or falls through the plane :S
If you parented it under another game object, have you tried making that other game object move?
Your answer
Follow this Question
Related Questions
About door opening with mousemovement! 5 Answers
How to make trigger play animation only once? 1 Answer
OnTriggerEnter? 4 Answers
Script for collectiong keys to escape 2 Answers
Key Item in C# 1 Answer