- Home /
Animation to Key Down Responsiveness
I'm using the mecanim animation tutorial from Unity and I'm having an issue with some of my animations and the "responsiveness" of them.
For example, lets say I jump by pressing the spacebar... When the animation finally ends and I'm back on the ground, pressing space doesn't work. The animation is "still in transition" for another split second. Now, I can reduce the transition time (or exit time) but it cuts the animation off. It looks really weird and doesn't achieve the "jump" itself.
Another oddity is that sometimes, even when the jump bool is not true and I should be able to jump - no transition to be had and I'm in locomotion, I still can't jump. I have to tap the keyboard a bunch.
Is there something in the code I can do to fix this?
if (currentBaseState.nameHash == locoState)
{
if(Input.GetButtonDown("Jump"))
{
anim.SetBool("Jump", true);
}
}
// if we are in the jumping state...
else if(currentBaseState.nameHash == jumpState)
{
// ..and not still in transition..
if(!anim.IsInTransition(0))
{
// reset the Jump bool so we can jump again, and so that the state does not loop
anim.SetBool("Jump", false);
}
Your code is completely fine (after all, it looks exactly like the tutorial script!). It actually depends on your animations and model, and your hardware (but I'll assume your hardware isn't glitchy, so mainly it's the assets).
SO what you can do is go into the prefab of the animation and edit the animation to your liking to make it shorter. Need more details?
And it depends on your state machine. Your transitions are all correctly in place so that the Jump Boolean works properly?