Strange state change time with Mecanim state controller

I have states “runjump”, made the transition from then end of the run timeline trans to the beginning of jump, it means the transition will just happen at the end of the run anim timeline, right, the run anim length is 1.5s, so i guess some times when i press jump key, the character will just really jump 1.5s later(some times lesser), right, but with my experiment result, it always change to jump after 0.033s (about 2 frames time, my FPS is about 60)

Is that strange?

There is no magic inside mecanim, the condition that you see in your transition inspector are the only thing that mecanim will look at to take this transition. It cannot assume that since the clip name is jump it should trigger the clip jump when the user press the jump key.

So right now your condition is probably set to exit time greater than x. Which does mean that mecanim will play the clip ‘run’ once and at x time it will make a transition to clip ‘jump’.

If what you want is make the character jump when the user press a key you need first to add a parameter ‘Jump’ to your controller.
Then in your transition between run to jump you can create a condition and choose the parameter Jump.
And finally you need to send the input from the gamepad to the animator parameter, something like this:
if (Input.GetButton(“Fire1”)) animator.SetBool(“Jump”, true);

Sonny

Thank you Sonny.

But i guess you misunderstood. Yes, i do have a key to make animator.SetBool(“Jump”, true); also the condition choose the parameter Jump.

What I want to figure out is: Does the transition self be a part of condition?
For example, suppose idle animation is long - 10 seconds length, it loops, and the trasition is set to happen start from 9.0s to 10.0s, so, if i press Jump key when the idle animation playhead is at 0, will it do the transition immediatlly? Or it will wait 9 seconds when the playhead is at the end of the animation?

I really want to know the inside, of the state machine.

it depend what are the transition’s condition. All the condition in a transition are ANDed

If the only condition is ‘Jump == true’, then it should take this transition as soon as your player press the jump button.
but if you also have by example exit time > 0.9 and jump == true, then it should take this transition only if the state time is greater than 0.9 and jump is true.

for a idle to jump animation, if both feet are always in contact with the floor for the idle animation you can make one transition with only one condition
jump == true

Sonny