# Control animation using animator control class

I did a sample existing code to control animation using animation.I dragged and dropped a character into the scene then I added a Animator to it and added the animator controller.Below I have given the screen short of the animation

Then I have attached the following code to it

Animator animator;

int eatHash=Animator.StringToHash("ideal");

int stateHash=Animator.StringToHash("Base Layer.pickbothfork");

void Start () {
animator = GetComponent<Animator>();
}

// Update is called once per frame
void Update () {
//animator.SetBool ("isEat", true);
float move = Input.GetAxis ("Vertical");
animator.SetFloat ("Speed",move);

AnimatorStateInfo stateinfo = animator.GetCurrentAnimatorStateInfo (0);
if (Input.GetKeyDown(KeyCode.Space))
{
Debug.Log ("clicked spacebar");
animator.SetTrigger(eatHash);
}
}


The problem here is the above code is working,when I run the project the animation is getting played one after the another according to the state diagram.But when I click on the space bar the trigger function(jump animation ) is not working

if (Input.GetKeyDown(KeyCode.Space))
{
Debug.Log ("clicked spacebar");
animator.SetTrigger(eatHash);
}


• In the above state machine, is the "ideal" event the event that goes between the "Idle" and "jump_pose" states? – CiscoIPPhone Sep 10 '14 at 15:04
• ys its a state flow from idle to jump_pose and so on – user1509674 Sep 11 '14 at 5:21
• Can you provide the infomations about parameters (which were cut off on the image.. ) and about the transition's activation conditions ? – tc07 Sep 23 '16 at 19:30