How do you trigger an animation with your Player?
I am hoping to make a cube that that has a box collider, and is set to trigger. I want to use this trigger to trigger an animation that I made in Unity. I'm hoping to trigger this trigger when the Player come into contact with it. In my case, have a bridge extend between two buildings when the player comes close to the edge of the building they are on.
Can anyone help me with this? I'm still very new to Unity and coding.
Thanks,
-Julian
Answer by Silentones · Jun 06, 2019 at 05:26 AM
This doc will/might help
and
I would try something like this
Animator Anim;
void OnTriggerEnter(Collider other)
{
if (other.tag == "Player")
{
Anim.SetTrigger("Jump");
Debug.Log("Player Should Jump");
}
}
I THINK. I got this idea from what I read in the doc's I linked.
Your answer
Follow this Question
Related Questions
Making a hit meter 1 Answer
How do i extend a animation ? 1 Answer
Play other object's animation on camera trigger 0 Answers
How do I not trigger animation during play state of the triggered animation. 1 Answer
ANIMATION TRIGGER DOESN'T PLAY 1 Answer