🤾‍♀️Basic Jump

Overview

The Jump state is in charge of allowing the character to Jump. Its State ID is 2. This State uses forces applied to the Rigid Body to make the character jump.

It does not require RootMotion Animations.

Here's the difference between the Basic Jump and the RootMotion Jump

Basic Jump goes to Fall Root Motion Jump finishes the animation

The Basic Jump will transition directly to the Fall state when the Jump time has elapsed. It does not require End Jump Animations.

The RootMotion Jump is more complex and it needs Start - Middle and End Jump Animations.

Use Basic Jump if just have just Jump and Fall Animations.

How it works

When the states get activated. A force will be applied to the character for a certain time using all the Jump Profile Properties. Gravity will be applied too at the same time.

The Forward Speed will be inherited from the last state the animal was playing.

Once the Jump time has elapsed, it will transition directly to the Fall State.. there's no End Jump Animation involved.

To achieve the different types of jump you will need to combine the Profile Jump values until you get the desired results.

Animation

Profile

Vertical Speed: 0 Jump Time: 0.4 Height: 14 Gravity Power: 4 Start Gravity Time: 25

Vertical Speed: 0 Jump Time: 0.2 Height: 6 Gravity Power: 4 Start Gravity Time: 0

Vertical Speed: 1.9 Jump Time: 0.3 Height: 4 Gravity Power: 1 Start Gravity Time: 0

Creating the State

To create a new Basic Jump State Click the Plus button on the States list.

Or duplicate any of the already created Basic States Assets of any animal you own and drag it to the States List.

Priority

The state should have a higher priority than Idle, Locomotion, and but below Death since the animal can be killed at any time.

When the animal is in this state, all the Lower priorities states are ignored until the exit conditions for this state are fulfilled.

The Basic Jump State cannot be interrupted by any state when it is on the Jump Time. Meaning when it's applying the vertical force, no other state can be activated.

Requirements

The Basic Jump State does not require extra gameobjects, pivots, or internal animal configuration. Just an animation to be used as Jump.

Activation

The state does not have an automatic activation, but they are several ways to activate the state:

Input

The state can be used when the Jump input is Pressed Down.

This will be connected automatically with the state Input value (by default is set to "Jump")

Zones

Entering a Jump Zone can activate the Jump state.

Animal Reaction

Animal Reactions can be used to activate the state. Check Reactions

Public Method

To activate the Jump State via script call the method:

Animal.State_Activate(2) or Animal.State_Activate(StateEnum.Jump)

Exit Conditions

Through code, the exit conditions will be executed to check if the State can exit. In the case of this state, the conditions are:

  • Jump time has elapsed since the state was activated.

Animator

The Jump state requires the Animation States that are in charge of the Jump Logic.

Jump Sub-State Machine

The Sub-State Machine [Jump] has Enter and Exit Transitions

The exit transition is the same as all the other states. No conditions are needed.

Core Animation

All States have a core animation, on which the animal will stay while the state is active. In case of Jump will be the Jump Animation State.

This core animation must be always tagged just like the Name of the State ID.

Exit Transitions

The condition for exiting the jump animations is State Not equal to 2. Which means the Active State is no longer the Jump State (2)

If you have multiple jumps, all exit transitions must be the same.

One Jump

Most of the time your character will have only one Jump. In that case you can simply add one Animation State with the Jump Animation.

Jump height, time and power are set on the Jump State parameters

Multiple Jumps

Character can perform multiple Jumps my increasing the Jumps parameter

This value will be set on the State Status parameter on the Animator

The Jump Count will be set starting on Zero:

First Jump the State Status is Zero, Second Jump will be 1 Third Jump will be 2, and so on.

The order of the Transitions are also very important. They should be ordered by the Number of the Jump first, and then by the Vertical Speed.

Jump Parameters

Wait for Animation

This parameter is used to delay the Activation of the Jump logic, by waiting for the animation proper time.

When this parameter is set to true, the Animation will notify the Jump State when to start applying the force to the animal to make the Jump. This is useful when you have animations with a bit of anticipation time.

To notify the Jump State, Add the Message Behaviour to the Animation with the message ActivateJump()

Wait For Animation: ON Wait For Animation: OFF

Jumps

Amount of Jumps the character can perform. If you want different animations for each new Jump, use the State Status Parameter on the Animator to transition to each animation. Check Multiple Jumps.

Jump Pressed

True: The Jump Force will be applied only when the Input is Pressed down.

False: The jump will have the same height. Pressing or Releasing the Input won't affect the Jump Force.

Jump Pressed: ON Jump Pressed: OFF

Jump Pressed Lerp

Smooth value to remove the Height when the Input is released, if Jump Pressed in ON.

Air Control

The animal can be controlled while is on the Air. Use this value works together with the Fall State Air Control Parameter.

Air Control: ON (Jump and Fall) Air Control: OFF (Jump and Fall)

Air Smooth

Lerp value to control the animal while is on the air. Higher values, more responsiveness

Air Rotation

Additional Rotation Speed while Jumping

Air Movement

Additional Position Speed while Jumping

Reset Jump States

Which States will reset the Jump Count, when the animal has multiple jumps. Internally Idle and Locomotion will reset the Jumps. So it can perform multiple jumps again.

Jump Profiles

Jump Profiles are use to have different Jump movement when the animal is on a different vertical speed or state.

E.g. the Height and Forward Movement of Jumping in Place can be different if the Animal is Jumping while Running

Combining the values on the Profile you will get different types of jumps.

Animation

Profile

Vertical Speed: 0 Jump Time: 0.4 Height: 14 Gravity Power: 4 Start Gravity Time: 25

Vertical Speed: 0 Jump Time: 0.2 Height: 6 Gravity Power: 4 Start Gravity Time: 0

Vertical Speed: 1.9 Jump Time: 0.3 Height: 4 Gravity Power: 1 Start Gravity Time: 0

Name

Name of the jump profile.

Last State

Condition to activate the Jump profile. Checks if the Animal was on the require state to activate the jump profile. Use this to have different Jumps for the Animal when is swimming, grounded

If is set to None, the States won't be checked to activate the profiles..

Vertical Speed

It will check which Vertical Speed the animal is currently on to activate a profile.

Jump Time

Time to apply the Force on the Jump. This time will be used to Keep the State active and working. When the Jump time has elapsed, new states can be activated.

Height

Amount of vertical force to apply to the animal when its on the Jump Time.

Gravity Power

Custom gravity force to apply to the animal when its on the Jump Time.

Start Gravity Time

It will increase the gravity force using the time to calculate the gravity... greater values higher gravity force.

Last updated