🧗♂️Climb
(Simple Climb)
Overview
The Climb State is a basic climbing logic (Zelda Botw style) that moves the animal on the surface of a wall.. Its State ID is 7.
Creating the State
To create a new Climb State Click the [ + ] button on the States list
Or just duplicate any of the already created Climb 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 Fall. but below Death, since the animal can be killed at any time. Remember States work by priority; If you need to Jump or Fly while the animal is in the Climb state, those states should be above Climb.
When the animal is in this state, all the Lower priorities states are ignored until the exit conditions for this state are fulfilled.
Requirements
All Climbable surfaces need to have a collider be with the Material "Climbable"
All Climbable surfaces must have the same layer as the Climb State Layer Parameter:
Activation
The climb state uses the Climb Pivot Values to detect climbable surfaces.
You need to select on the State List of your character, the Climb State. In order to see the gizmos
By Input
If the rays detect any of these surfaces, use the Climb State Input value to Start the state.
In the case of the Human and the Racoon, I use the same Input for the Action Mode. So if the Raccoon press <E> it will start climbing.
Automatic
Set the Automatic Parameter to true and the Animal will activate the State as soon the Ray finds any climbable surface.
Zones
Zones can also be used to activate the state. Set a zone in front of a climbable surface and the State will be activated.
Reactions
Animal Reactions can be used to activate the state. Check Reactions
Exit Conditions
Internally, the exit conditions will be executed to check if the State can exit.
Since all Exit Conditions need Animations, all Exit Animations require the AllowExit Behavior in them.
Climbing Down
When the animal is Climbing Down (Pressing the S Key to Move Down); a Ray will be cast to search for the ground beneath the animal. If the ray touches the ground. This exit condition forces the Idle state to be activated after.
Climb Up a ledge
The animal will cast 2 Rays to find a Horizontal ledge. If it finds it then it will play the Ledge Exit Animation. This exit condition Forces the Locomotion state to be activated after and sets the StateExitStatus to 1.
Unclimbable surface
The Wall does not have the <Climb> Material Surface. This condition allows lower-priority states to be activated.
High Priority States
Any high-priority states can be Activated, forcing the Climb state to exit:
Exit Input
Pressing the Exit Input State the state will exit too
Common State Properties
The basic setting for the Climb state is very similar for all the animals.
Main Tag [Climb]
☑️RootMotion | ☑️Sprint | ◻️Gravity |
◻️Grounded | ☑️Custom Rotation | ◻️Orient To Ground |
☑️Ignore Lower States | ◻️Persistent = False | ◻️Lock Move |
◻️Lock Input | ☑️+ Root Speed = True | ☑️ + Pos Speed |
◻️ Free Movement |
Limits
Sleep From State: (OPTIONAL)
Underwater, Fly. You don't want to use the climbing when those states are active
Sleep from Mode (OPTIONAL)
Attack, Action. You don't want to use the climbing when those Modes are active
Queue From <None>
Animator
Climb SubState Machine
The Climb state requires the Animation States that are in charge of the Climbing movement.
Core Animation
All States have a core animation on which the Animal will stay while the state is active. In case of Climb will be the Climb BlendTree Animation state.
This core animation must be always tagged just like the Name of the State ID.
Since the State is a moving state, the Speed Multiplier must be set as Parameter "SpeedMultiplier"
This Climb Blend Tree is usually set this way:
It uses 8 Directional animations to move around the surface
If you don't have all the animations, you can fill the missing states with duplicate animations
Additional Animations
To have a smoother state Climb should have extra animations to transition to and from the core animations.
Climb Start
Climb Start is used when the Last State is Idle or Locomotion to quickly align the Animal to the Wall while the animation is playing.
This animation must be tagged as <ClimbStart>
The Enter Transition is Last State < 2 (Meaning the last state was Idle (0) or Locomotion (1) )
Climb Down
This Exit Animation is Activated when the animal is going down. Pressing the S Key.
This animation is tagged as <ClimbExit>
The Enter Transition from Climb is StateExitStatus = 3. Just like the value set in ClimbDown
Grounded = True can be used on the transition as an alternative.
Climb Edge
This Exit Animation is called right after the <Climb Up a Ledge> conditions are fulfilled.
The Tag used on the Animator State is <ClimbEdge>
The Enter Condition is Exit Status =1. Just like the value set in the parameter Climb Ledge
Tag Modifiers
Tag Modifiers change properties on the Animal Controller every time the Animal enters an animation with any of the included tags on the list.
Speed Set
The Climb needs a new Speed Set that affects the State
If your Climb animations are NOT RootMotion Animations, increase the Position and values to be greater than zero.
Climb Parameters
Climb Layer
Layers needed to detect climbable colliders.
Surface Material
Surface Material needed on the colliders to recognize Climbable surfaces
Automatic
When this parameter is true, the animal will climb automatically a surface if is near it
Climb Pivots
Values to set properly all raycasts needed to climb Climbable surfaces.
Climb Chest
Pivot to cast a ray from the chest.
Climb Hip
Pivot to cast a ray from the hip.
Climb Ray Length
Lenght of both Hip and Chest Rays
Ray Radius
Radius of the Rays to detect walls
Wall Detection
Wall Distance
When aligning the Animal to the Wall, this will be the distance needed to separate it from it.
Align Smoothness
Smoothness value to align the animal to the wall.
Ground Distance
Distance from the Hip Pivot to the Ground. This value is used to find the ground while the animal is climbing down. Using the S key. Is represented by a White Ray.
Inner Corner
These represent 2 rays to detect Inner 90-degree corners to position the character to the right spot when detected.
If the Ray touches an inner 90-degree wall, a quick alignment will occur
Use this if you don't have turn-inner corner animations
Outer Corner Speed
Additional Speed used to move faster around the outer 90 corner
Use this if you don't have turn-outer corner animations
Exit State Status
Climb Ledge
Value of the State Exit Status value on the Animator to Activate the Climb Ledge Animation
Climb Off
Value of the State Exit Status value on the Animator to Activate the Climb Off Animation
Climb Down
Value of the State Exit Status value on the Animator to Activate the Climb Down Animation
Ledge Detection
These parameters are used to Detect a ledge when the Animal is Going Up
Ray Ledge Offset
Relative Offset Position to Cast the First Ray on top on the animal to find the ledge. Its represented by a Red Ray
Ledge Rays
Length of the Ledge Ray
Ledge Min Exit
Minimum Distance needed to Activate the Exit Ledge Animation. If the Second Ray Distance to the surface is greater than this value, the StateExitStatus parameter will change the value to Climb Ledge.
Last updated