- Home /
Collison based animation not working
Below is the script we are using to try to get a door to open in our game. When the player hits the box collider on the door nothing happens, and the open print never appears in the log. Any help would be greatly appreciated.
function OnTriggerEnter(collision: Collision) { switch (collision.gameObject.tag) { case "Player" : animation.play("dooropen"); print ("open"); break; } }
Answer by Nemox · Dec 19, 2012 at 06:44 PM
Are you using a character controller? If I remember correctly, they don't generate collisions for other colliders under normal conditions, only themselves. Try sticking a rigidbody on it as well and see if it helps. The character controller properties and usage should override the rigidbody's properties.
There is a rigidbody on the door, and i have tried adding the script to the character as a case in the character controller. Thank you for all your help.
Your answer
Follow this Question
Related Questions
On collision play animation 1 Answer
can morph be used in u nity 1 Answer
Can someone help me with my script? 0 Answers
How to Play an Animation in Unity 4.5.3? 0 Answers