🤾♀️Basic Jump
Last updated
Last updated
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.
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.
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
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.
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.
The Basic Jump State does not require extra gameobjects, pivots, or internal animal configuration. Just an animation to be used as Jump.
The state does not have an automatic activation, but they are several ways to activate the state:
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")
Entering a Jump Zone can activate the Jump state.
Animal Reactions can be used to activate the state. Check Reactions
To activate the Jump State via script call the method:
Animal.State_Activate(2)
or Animal.State_Activate(StateEnum.Jump)
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.
The Jump state requires the Animation States that are in charge of the Jump Logic.
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.
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.
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.
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
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.
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
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.
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
Smooth value to remove the Height when the Input is released, if Jump Pressed in ON.
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)
Lerp value to control the animal while is on the air. Higher values, more responsiveness
Additional Rotation Speed while Jumping
Additional Position Speed while Jumping
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 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.
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 of the jump profile.
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..
It will check which Vertical Speed the animal is currently on to activate a profile.
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.
Amount of vertical force to apply to the animal when its on the Jump Time.
Custom gravity force to apply to the animal when its on the Jump Time.
It will increase the gravity force using the time to calculate the gravity... greater values higher gravity force.