- Home /
Question by
dvitarelli · Jun 26, 2018 at 02:19 PM ·
c#animationtrigger
Need animation curve created in Unity to begin with a trigger
I have a character that is running around a tree. It begins with an idle pose and when I press "R" it begins to run. The run cycle was done in Maya. The running around the tree, a simple 360 Y Rotation, was animated in Unity. The Y Rotation begins as soon as the game begins, the Culling Mode is set to "Always Animate" but I would like the Y Rotation to begin when the "R" key is pressed with the Run animation.
Here's what I have:
public Animator anim;
// Use this for initialization
void Start () {
anim = GetComponent<Animator>();
//AudioSource audio = GetComponent<jump.wav> ();
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.R)){
anim.SetTrigger("beginRun");
}
if (Input.GetKeyDown (KeyCode.J)){
anim.SetTrigger("jumpUP");
//audio.Play ("jump");
}
}
}
Is there a way to connect the Y Rotation to the trigger. Thanks
Comment
Your answer
Follow this Question
Related Questions
Triggering animation on click when a key is collected 1 Answer
play only one door animation 1 Answer
How to override an animation? 0 Answers
How do I trigger an animation using a button? 3 Answers
Animation with frozen player ?? 0 Answers