Question by
katerinatsir · Feb 14, 2016 at 10:22 PM ·
triggering animation box collider
Animation is not triggered on collision
Hello! I have a sphere for which i have made an animation which i want to be triggered when my player (fps controller) hits a box that acts as trigger.I have is trigger of the box checked. I have placed my sphere in the variables row of my script. I have placed the script in the box as a component. I also have turned the animator of my sphere off so that the animation gets enabled when my player hits the box collider. And i have tagged my fps player as player! But the trigger doesnt work!! In one other project i have it works perfectly!!! I use Unity 5.3
Here is the script:
using UnityEngine; using System.Collections;
public class EnableAnimation : MonoBehaviour {
public GameObject animatedObject;
void onTriggerEnter(Collider other) {
if (other.gameObject.CompareTag("Player")){
Debug.Log ("Hello");
animatedObject.GetComponent<Animator>().enabled = true;
}
}
}
Comment