- Home /
Animation not playing but trigger works
hi, i have a chest game object called "Chest1" and i have a mesh collider on it with isTrigger ticked, and an animation attached with "Take 001" in the animation slot- this is the actually animation of the chest lid opening.
This is the script i have at the moment,
function OnTriggerEnter (Player : Collider) {
animation.Play("Take 001");
}
This script is attached to chest game object. When the first person controller named "Player" reaches the chest i want it to play the animation of the lid opening, but it isnt doing so. Any suggestions are appreciated.
Thanks in advance
Answer by Zib Redlektab · Apr 14, 2011 at 06:16 PM
Is there code elsewhere that tells the animation to not play when the user is outside the trigger area? OnTriggerEnter only gets called when the colliders intersect, so if you're standing inside the collider entirely, it doesn't get called.
If you're telling the animation to stop when the player is outside the trigger area, and you're using OnTriggerEnter to detect when the player is inside the trigger area, that would be your problem.