๐Ÿง—โ€โ™‚๏ธLedge Grab

Overview

The Grab Ledge State is used to perform a quick ledge climb when the character is near a flat surface. Its State ID is 8.

Creating the State

To create a new Ledge Grab State, click the [ + ] button on the States list.

Or just duplicate any of the already created Ledge Grab 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 Ledge Grab state, those states should have a higher priority.

Requirements

  • The state uses raycasting to find nearby surfaces. These colliders need to have the same Layer as the Ledge Layer Parameter

Activation

The state uses the values from the Profiles to cast rays that can detect colliders in front of the character. 3 Rays are Used for each Profile.

  • A first ray on the Top (Green) is cast to check if there's no Collider in Front.

  • A second ray is cast starting from the end of the first ray to find a collider downwards (Red)

  • A third ray is cast from the chest of the character, to detect a wall in front of the character (Yellow)

The State will be activated if the Top (Green) does not detect a collider and the Down (Red) and Wall(Yellow) rays detect a collider.

By Input

If the rays detect any of these colliders, use the Ledge State Input value to try to activate the state.

Automatic

Set the Automatic Parameter to true and the Animal will activate the State as soon the Ray finds any collider that can be ledge climbed, and the conditions of the rays are met.

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.

In the case of Ledge Climb the State will exit automatically when the Exit Time of the Active profile has elapsed.

Animator

Ledge Grab Substate Machine

The Climb state requires an Animation State that is in charge of the Ledge Grab movement.

Transition Duration

The positioning and alignment of the character to the correct position is determined by the transition time of the Any State to the State Animations. By default is set to 0.1

This value is really important and is used in the Profile Offset Position values.

Core Animation

All States have a core animation on which the Animal will stay while the state is active. In the case of Ledge Grab will be the animations for each ledge Grab Profile.

The condition to enter the right profile is the value of the Enter Status Parameter.

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

General [Tab]

The basic setting for the Ledge state is very similar for all the animals.

Tags[Tab]

Since the state only uses an animation per activation, meaning there are no enter or exit animation clips, there is no need to use Tag modifiers or Enter/Exit Tag.

RootMotion, +Rot , +Pos, and Ignore Lower State should be enabled, all other tag modifiers should be disabled.

In this state the animal is not Grounded, Gravity is disabled, and there is no Orientation to the ground.

Limits [Tab]

Limits can be set to your own needs. If you want to disable/sleep the state while the character is in another state, or when is playing a mode, or stance; it can be done in this section.

E.g. Ledge grab is sleep if the character is on swimming underwater.

Speeds [Tab]

This state does not require any Speed Modifiers. All the movement is done either by RootMotion or via the Profiles.

Ledge Parameters

Ledge Layer

Layer to Identify Edge surfaces

Automatic

The state will be activated as soon as the Try Activate conditions are met (Rays Conditions) No need to use the Input

Kinematic

The character rigidbody will be kinematic as long as the state is active. Use this when collides are not allowing the correct movement of the State)

Wall Distance

The distance needed to place the character in front of the wall when the state is activated

Min Terrain Angle

If the Top Surface is not Flat. It must have in the range of 0 and this value in order to be able to activate the State

Forward Length

Global Front Distance to check colliders in front of the character (Green and Yellow Ray Length )

Wall Checker

Vertical Distance to check the Wall in front of the character (Yellow Ray Height)

Profiles

Name

Name of the Profile

Enter Status

This value is used by the Animator to activate the correct animation

Max V Speed

Maximum Speed the character may need to check and use a profile.

E.g. If the Animal is Walking (Speed 1) or running (Speed 3), you can have different profiles for each activation.

Forward Multiplier

Local Forward Length applied to the global Forward Length (Green Ray)

Height

Height value for the Top Ray (Green ray).

Ledge Exit Distance

Height Value of the Down Ray. This ray is in charge of finding a flat surface (Red Ray)

Exit Time

The time needed to activate the Allow Exit() Method on the state. (by Default is 0.9 almost at the end of the animation). This allow other lower priorities states to activate themselves

Align Offset

Offset values on the Vertical and Forward position applied to the character when it starts the state.

Try different values until you get the proper hand placement on the state.

This Align value is very tight to the Animator Transition Time. If you change the transition time you need to update these values.

Orient

When enabled, it will orient the character perpendicular to the wall.

Orient Smoothness

If Orient is enabled, this is the smoothness value to orient the character perpendicular to the wall.

Additive Position

When is enabled, it will add vertical and forward movement to your character in case your animations are not RootMotion.

Height Speed

Amount of Vertical Push added to the character when the state is enabled

Forward Speed

Amount of Forward Push added to the character when the state is enabled

Height Curve

The multiplier of the Height Speed throughout the whole animation.

E.g. in the First half of the animation, the character will be pushed in the vertical axis, but in the other half, NO Vertical movement will be applied.

Forward Curve

The multiplier of the Forward Speed throughout the whole animation.

E.g. in the First half of the animation, the character will NOT be pushed in the Forward axis, but in the other half will be moved forward.

Last updated