Hello
I need my ai to activate an animation controller when it hits a box collider (set as is trigger). But I have idea how to do this especially since the collider isn’t on the ai.
Thank you
Hello
I need my ai to activate an animation controller when it hits a box collider (set as is trigger). But I have idea how to do this especially since the collider isn’t on the ai.
Thank you
Do you want to enable the animator component? Then just take Lex_87’s code and replace the OnCollisionEnter function with
void OnTriggerEnter(Collider collidingObject)
{
// get a reference to your character
if(collidingObject.tag == "InsertYourTagHere") // Or collidingObject.gameObject.tag instead. I'm not sure
{
collidingObject.gameObject.GetComponent<Animator>().enabled = true;
}
}