Jumping with Animation States

Hey everyone, I’m having a bear of a time trying to figure out some basic jumping with animation states. I have movement and basic attacks down pretty easily, jumping is proving far more difficult.

I have an Idle and Run state and inside both I have code to transition to the Jump state:

if (Input.GetButtonDown("Jump"))
        {
            animator.SetTrigger("Jump");
        }

from here I move to the Jump state, but I can’t seem to get my player to move up. I have found tons of different codes online but none seem to work right with animation states. I am not sure how I would go about adding the force needed to make my player jump up. Any ideas? Should I make a separate state for jumping and falling or should I just put the code into my Running/Idle states instead?

After the Jump state I transition to a Falling state, then back to Idle. The Falling state is where I want to put all the data for gravity and falling. Especially since it will work well for having players just run or fall I can easily transition into this state.

Hey there!

To accomplish that you would need to do something different then just setting the trigger of your animator,

you will need to add a force to jump since the animator only does the animation nothing else :slight_smile:

            if (Input.GetButton("Jump"))
                animator.SetTrigger("Jump");
                moveDirection.y = 10f;

That makes sense, I’ll try to add in some force to see if it works well. Other tutorials I have looked at that add force didn’t help me much