Ledge is a helper that defines a place where player/NPC can jump over or jump onto a something, for example a fence or a small cliff. Without ledge helper, this functionality is not available. Creating Ledge
One can define ledges using Ledge or Ledge static under GameCustom object category. Ledge object creates ledge entity to which flowgraph or script can be attached. LedgeStatic creates only game object which have smaller memory footprint than entity.
Note: always use LedgeStatic unless you have good reason to use Ledge.
Place ledge object on top of geometry as you can see on the pictures below. You can use advantage od "Follow terrain and Snap to Objects" button to snap Ledge to the collision.
There are several properties you can define in property rollout.
Most of these properties sets up specific mannequin fragment tag when ledge is triggered. This allow us to have different animation for different type of ledges.
Everytime ledge is triggered in game mode, "ledgeGrab" fragment ID is activated along with one or more tags depending on triggered ledge object. Property Tag (optional) Description IsThin over/up Marks thin ledges on which player cannot stand. If thin ledge is selected animation should ends behind the ledge. IsWindow - Ledge animation is always used for window ledges. LedgeDoubleSide - Ledge can be accessed from both sides. LedgeFlipped - Changes facing direction of the ledge. EndCrouched - Not used. Endfalling - Player goes to falling state after ledge transition ends. LedgeType vault/high/- Used to select proper transition. See below how to define transitions. UsableByMarines - Not used.
More artist-friendly explanation:
for fences – isThin and LedgeDoubleside checked for overhangs – isThin and LedgeDoubleside unchecked. Make sure the ledge is created from right to the left (as on the image of landslip above), otherwise LedgeFlipped needs to be checked to maintain proper orientation. See also Debug chapter
All the object that have ledges on must have checked gcc_ledge parameter. This will make ledge-jumping animation ignore collision of this object, otherwise the collision could block the animation or the animation would end up in the air. It can be taken advantage of Default brush parameters here.
If you place the edge on the fence for example, make sure there is a free space behind the fence so the player has a room to jump and land. If there is a big bush or some other object right behind the fence, just leave the ledge segment in that area.
Debuging Debug button
1. Pin 3DDebug panel onto your toolbar.
2. Hit Ledges button to toggle ledge debug on and off.
Example of good/wrong ledge orientation (see the blueish triangles):
Example of good/wrong ledge height (notice debug ledge color). You can see the problem is with the fence model itself - it's too tall to be able to jump over. You can move the ledge down to make it work, but then the player will jump through the top part of the fence and not over it, which might not look too good (of course some visual toleration is possible):
Other useful cvars
Following are script/animation stuff. Transitions
Everytime ledge is triggered one of predefined transition shall be selected. Transtion have to match ledge type and properties to be selected. If more than one transition match then best transition is selected according distance from starting point to transition start point.
Transitions are defined in actor parameters file. For player it is located in: "Game\Scripts\Entities\actor\Parameters\Player_Params.xml".
Example of ledge transition definition:
<LedgeGrabbingParams normalSpeedUp="1.0" powerSpeedUp="1.0" mobilitySpeedUp="1.5" mobilitySpeedUpMaximum="1.75" > <!--SP PARAMS--> <LedgeNearByParams searchDir="0.0, 1.0f, -0.1" maxDistance="1.0" maxAngleDeviationFromSearchDirInDegrees="40" maxExtendedAngleDeviationFromSearchDirInDegrees="45" GAME="SP" /> <VaultOver positionOffset="0.0, 1.7, 1.0" moveDuration="0.5" correctionDuration="0.05" heightMin="1.0" heightMax="1.4" allowedHeightMin="0.9" allowedHeightMax="1.5" ledgeType="Thin" isVault="1" exitVelocityY="6" exitVelocityZ="-4" keepOrientation="1" GAME="SP" /> </LedgeGrabbingParams> LedgeNearByParams
This section does not defines transition but some general ledge dertection params.
search dir - this vector is used when searching for usable ledges around player max distance - max distance in 2D to ledge maxAngleDeviationFromSearchDirInDegrees - max angle deviation for ledges maxExtendedAngleDeviationFromSearchDirInDegrees - max angle deviation for vaults
There are several predefined ledge transition which you can modify. In case you need aditional ones feel free to contack you favourite programmer.
positionOffset - offset from ledge to entity start point. Distance from this point is considered when selcting best ledge transition. moveDuration - not used correctionDuration - not used heightMin/heightMax - defines min and max bounds for transition blend space allowedHeightMin/allowedHeightMax - defines min and max limits for the transition to be used by the actor. The interval may be greater then the blend space interval to allow usage on slopes, albeit the result is visually compromised (using the extreme value of blend space) ledgeType - (Thin/Wide) this transition is used only for thin or wide ledges isVault - if true this transition is used only for vault ledges exitVelocityY/exitVelocityZ - defines entity velocity after transition end keepOrientation - if false entity orientation is changed in order to face to the legde