Triggering door animation with collider

I have a door with animations and a empty game object separate to this which has a box collider with trigger marked, I’ve been looking everywhere for some script to make the door open when the character enters the trigger box collider. I’ve been searching everywhere for a script to add to the game object and one to add to the door to make them work but i’ve had no luck and I feel like i’ve tried everything. Does anyone had a script I can try. It would really help me out.


  • James

Try this:

function OnTriggerEnter(other : Colldier) {

I assume this is what you need.

The script above would work. However, it would be best if the trigger was directly assigned to the door. ie not having the trigger on a separate object. Having a script assigned to the empty would apply the actions to the empty (not giving the desired result), likewise having it on the door would not do anything as the door itself does not have the trigger required. Give the door another box collider set as a trigger, and assign the script to the door, delete the empty.