- Home /
Best Answer
Answer by save · Apr 04, 2012 at 08:32 PM
Use a raycast towards the object that should trigger the door, then alter a boolean or execute a function which opens the door.
private var open : boolean = false;
function AlterDoor () {
open = !open;
if (open) {
Animation.Play("Open");
} else {
Animation.Play("Close");
}
}
Answer by Meltdown · Apr 04, 2012 at 07:30 PM
Look up triggers.
Activate the trigger via scripting.
If you have no idea how to do that.. I'd suggest doing some tutorials and scripting tutorials.
Your answer
![](https://koobas.hobune.stream/wayback/20220613065913im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
key to open gate 1 Answer
GUI text, door and object collider 2 Answers
Open door with key 1 Answer
Make doors open with different keys? 1 Answer
Opening a door with a key 2 Answers