User Tools

Site Tools


dragengine:modules:dragonscript:behavior_locomotion

ECBehaviorLocomotion

Behavior element behavior adding locomotion support for actors.

Adds Locomotion. Actors use Locomotion to move their AI colliders across the game world. Locomotion also provides values for AnimatorController to provide animation to actors matching their movement.

Uses collider of ECBehaviorColliderAI or ECBehaviorCollider depending which one is present. If both are present ECBehaviorColliderAI is preferred.

By default creates instance of Locomotion. This class provides all the basic behavior to do locomotion for different type of actors. Supports organic locomotion of 2-legged and 4-legged characters with natural and FPS type movement patterns as well as mechanical locomotion like vehicles.

Locomotion parameters have to be set on runtime. The behavior itself does not support initializing locomotion parameters. This is the case since locomotion parameters change a lot depending on what game situation an actor is located in. Use ECBehaviorActorAIAction, ECBehaviorStateMachine or ECBehaviorBehaviorTree for this task.

The ECBehaviorLocomotion provides access to the locomotion class to modify at runtime.

See also:

Instance Counts

This behavior can be used only once on an element.

Element Class Properties

Element class properties have the prefix locomotion. .

Events

This behavior has no events.

Behavior Tree Actions

This behavior adds these behavior tree actions if behavior tree is present.

locomotion.set

Set one or more locomotion parameters.

ParameterValueDescription
presethuman, vehicle

Initialize locomotion with common parameters.

human

Initialize locomotion with common human actor parameters. Sets these parameters:

  • Can turn: yes
  • Can turn in-place: yes
  • Linear velocity adjust range: Actor element class run speed
  • Linear velocity adjust time: 1
  • Moving left right adjust time: 0
  • Looking limits: -80..80 (up-down) and -90..90 (left-right)
  • Looking adjust times: 1
  • Orientation adjust time: 1
  • Turn adjust look left-right: yes
  • Turn in-place limit: -70..70
  • Turn in-place adjust time: 1
vehicle

Initialize locomotion with common vehicle parameters. Sets these initial parameters:

  • Can turn: yes
  • Can turn in-place: no
  • Linear velocity adjust range: Actor element class run speed
  • Linear velocity adjust time: 0.5
  • Moving left right adjust time: 0
  • Looking limits: -80..80 (up-down) and -90..90 (left-right)
  • Looking adjust times: 0
  • Orientation adjust time: 1
  • Turn adjust look left-right: no
  • Turn in-place limit: -70..70
  • Turn in-place adjust time: 1

These values are suitable for player controlled actors. For non-player controlled actors it might be useful to set these additional parameters:

  • Looking adjust time: 1
  • Linear velocity adjust time: 1
can.turntrue, falseActor can turn
alwaysLimitLeftRighttrue, falseLook left/right is always limited
limit.look.upfloatLooking up limit angle in degrees
limit.look.downfloatLooking down limit angle in degrees
adjust.vertical.timefloatLook up-down adjustment time in seconds
adjust.vertical.rangefloatLook up-down adjustment range
look.vertical.goalfloatLooking up-down goal
look.verticalfloatLooking up-down value
limit.look.leftfloatLooking left limit in degrees
limit.look.rightfloatLooking right limit in degrees
adjust.horizontal.timefloatLook left-right adjustment time in seconds
adjust.horizontal.rangefloatLook left-right adjustment range
look.horizontal.goalfloatLook left-right goal
look.horizontalfloatLook left-right value
analog.verticalfloatAnalog looking up-down
turn.horizontalfloatTurn left-right value
adjust.orientation.timefloatOrientation adjustment time in seconds
orientationfloatActor orientation in world space
turn.speedfloatTurning speed in meters per second
is.turning.inplacetrue, falseActor is turning in place
adjust.turn.inplace.timefloatAdjustment time in seconds for turning in-place
turn.inplacefloatTurn in place value
reset.time.turn.inplacetrue, falseTurn in place time linked controllers have to be reset
reverse.time.turn.inplacetrue, falseTurn in place time linked controllers have to be reversed
can.turn.inplacetrue, falseActor can turn in-place if looking beyond limits
limit.turn.inplace.leftfloatLooking left limit in degrees before turning in-place
limit.turn.inplace.rightfloatLooking right limit in degrees before turning in-place
adjust.analog.move.horizontal.timefloatAnalog looking left-right adjustment time in seconds
adjust.analog.move.horizontal.rangefloatAnalog looking left-right adjustment range
analog.move.horizontal.goalfloatAnalog looking left-right goal
analog.move.horizontalfloatAnalog looking left-right
analog.move.speedfloatAnalog moving speed
is.movingtrue, falseActor is moving direct or analog
move.speedfloatFor Non-FPS locomotion type this is negative for moving backward
adjust.linearVelocity.timefloatLinear velocity adjustment time in seconds
adjust.linearVelocity.rangefloatLinear velocity adjustment range in meters per second
move.orientationfloatMovement orientation in world space
move.directionfloatMovement direction relative to view orientation
reset.time.walktrue, falseWalk/run time linked controllers have to be reset
adjust.stance.timefloatAdjustment time for stance in seconds
adjust.stance.rangefloatAdjustment range for stance
stancefloatStance value
stance.goalfloatStance goal value
can.tilttrue, falseActor can tilt the body
tilt.modenone, single, weighted

Tilt mode

noneNo tilt calculation.
singleCalculate tilt from the hit normal of a a single ground test. The single test is cast down at the center of the actor. The hit normal is used to calculate the tilt in both directions relative to the actor coordinate system. This test mode is the fastest and suitable for simple bipedal actors in simple shaped worlds.
weightedCalculate tilt from 4 weighted ground tests in a box shape. 4 samples arranged in a box around front and back feet are cast down and weighted. This test mode improves the quality over dedsLocomotion::etmSingle but is more expensive to calculate. It is suited for all kinds of actors or complex worlds.
limit.tilt.upfloatTilt up limit in degrees
limit.tilt.downfloatTilt down limit in degrees
tilt.verticalfloatCurrent tilt up/down angle in degrees
tilt.vertical.goalfloatGoal tilt up/down angle in degrees
adjust.tilt.vertical.timefloatTilt up/down adjust time in seconds
adjust.tilt.vertical.rangefloatTilt up/down adjust range
limit.tilt.leftfloatTilt left limit in degrees
limit.tilt.rightfloatTilt right limit in degrees
tilt.horizontalfloatCurrent tilt left/right angle in degrees
tilt.horizontal.goalfloatGoal tilt left/right angle in degrees
adjust.tilt.horizontal.timefloatTilt left/right adjust time in seconds
adjust.tilt.horizontal.rangefloatTilt left/right adjust range
tilt.offsetfloatTilt offset in meters

This is an example of using this action:

<action name='locomotion.set'>
  <parameter name='preset'>human</parameter>
</action>

locomotion.update

Update locomotion.

ParameterValueDescription
cancel.input

Cancel input. Resets these parameters:

  • Analog moving left-right: set value and goal to 0
  • Analog moving speed: set to 0
  • Turn left right: set to 0
  • Look left-right: set goal to value
  • Look up-down: set goal to value

Stance: set goal to value

cancel.movement

Cancel Movement. Includes cancel.input. Resets these parameters:

  • Linear velocity: set goal and value to 0
  • Moving speed: set to 0
  • Moving orientation: set to 0
  • Moving direction: set to 0
cancel.motion

Cancel motion. Includes cancel.movement and cancel.turn.inplace. Resets these parameters:

  • Turning speed: set to 0
  • Turn in-place: set to 0
  • Tilt left-right: set goal to value
  • Tilt up-down: set goal to value
cancel.turn.inplace

Cancel turning in-place. Resets these parameters:

  • Turn in-place: set to 0
  • Is Turning: set to false
forceBodyAdjustment Force body adjustment
stopMoving Clear all movement to ensure actor is not unintentially moving
resetLooking Reset looking vertically and horizontally to 0
looking Update looking
locomotion Update locomotion
isMoving Update is moving
orientation Update orientation
linearVelocity Update linear velocity
stance Update stance
postLocomotion Update locomotion after physics calculations
tilt Update body tilting
animator Update animator instance controllers if set with locomotion parameters
aiCollider Update AI collider linear and angular velocity
adjustOrientation

Adjusts various orientation parameters to rotate by a given angle ensuring all relationships between the various parameters are still correct. Use this method if you want to manually rotate an actor while keeping the looking and movement direction intact. In particular this method adjust the following parameters without taking limitations into account:

  • Orientation
  • Look horizontal
  • Look horizontal goal
  • Analog move horizontal
  • Turn horizontal
applyStates Apply states without interpolation or smoothing
colliderFromLocomotion.orientation Set collider AI orientation from locomotion orientation
colliderFromLocomotion.linearVelocity Set collider AI linear velocity from locomotion linear velocity
wait If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled

This is an example of using this action:

<sequence>
  <action name='locomotion.check'>
    <parameter name='enabled'>true</parameter>
  </action>
  <!-- actions here run only if locomotion is enabled -->
</sequence>

locomotion.check

Check one or more locomotion parameters. Action succeeds if all parameter value matches their respective locomotion parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a locomotion parameter matches (or not).

ParameterValueDescription
can.turntrue, falseActor can turn matches value
alwaysLimitLeftRighttrue, falseLook left/right is always limited matches value
limit.look.up.lessfloatLooking up limit angle is less than value in degrees
limit.look.up.greaterfloatLooking up limit angle is greater than value in degrees
limit.look.down.lessfloatLooking down limit angle is less than value in degrees
limit.look.down.greaterfloatLooking down limit angle is greater than value in degrees
adjust.vertical.time.lessfloatLook up-down adjustment time is less than value in seconds
adjust.vertical.time.greaterfloatLook up-down adjustment time is greater than value in seconds
adjust.vertical.range.lessfloatLook up-down adjustment range is less than value
adjust.vertical.range.greaterfloatLook up-down adjustment range is greater than value
look.vertical.goal.lessfloatLooking up-down goal is less than value
look.vertical.goal.greaterfloatLooking up-down goal is greater than value
look.vertical.lessfloatLooking up-down value is less than value
look.vertical.greaterfloatLooking up-down value is greater than value
limit.look.left.lessfloatLooking left limit is less than value in degrees
limit.look.left.greaterfloatLooking left limit is greater than value in degrees
limit.look.right.lessfloatLooking right limit is less than value in degrees
limit.look.right.greaterfloatLooking right limit is greater than value in degrees
adjust.horizontal.time.lessfloatLook left-right adjustment time is less than in seconds
adjust.horizontal.time.greaterfloatLook left-right adjustment time is greater than in seconds
adjust.horizontal.range.lessfloatLook left-right adjustment range is less than value
adjust.horizontal.range.greaterfloatLook left-right adjustment range is greater than value
look.horizontal.goal.lessfloatLook left-right goal is less than value
look.horizontal.goal.greaterfloatLook left-right goal is greater than value
look.horizontal.lessfloatLook left-right value is less than value
look.horizontal.greaterfloatLook left-right value is greater than value
analog.vertical.lessfloatAnalog looking up-down is less than value
analog.vertical.greaterfloatAnalog looking up-down is greater than value
turn.horizontal.lessfloatTurn left-right value is less than value
turn.horizontal.greaterfloatTurn left-right value is greater than value
adjust.orientation.time.lessfloatOrientation adjustment time is less than value in seconds
adjust.orientation.time.greaterfloatOrientation adjustment time is greater than value in seconds
orientationfloatActor orientation to check
orientation.lessfloatDifference between orientation and actor orientation normalized to the range between -180..180 is less than value
orientation.greaterfloatDifference between orientation and actor orientation normalized to the range between -180..180 is greaterless than value
turn.speed.lessfloatTurning speed is less than value in meters per second
turn.speed.greaterfloatTurning speed is greater than value in meters per second
is.turning.inplacetrue, falseActor is turning in place matches value
adjust.turn.inplace.time.lessfloatAdjustment time is less than value in seconds for turning in-place
adjust.turn.inplace.time.greaterfloatAdjustment time is greater than value in seconds for turning in-place
turn.inplace.lessfloatTurn in place value is less than value
turn.inplace.greaterfloatTurn in place value is greater than value
reset.time.turn.inplacetrue, falseTurn in place time linked controllers have to be reset matches value
reverse.time.turn.inplacetrue, falseTurn in place time linked controllers have to be reversed matches value
can.turn.inplacetrue, falseActor can turn in-place if looking beyond limits matches value
limit.turn.inplace.left.lessfloatLooking left limit in degrees before turning in-place is less than value
limit.turn.inplace.left.greaterfloatLooking left limit in degrees before turning in-place is greater than value
limit.turn.inplace.right.lessfloatLooking right limit in degrees before turning in-place is less than value
limit.turn.inplace.right.greaterfloatLooking right limit in degrees before turning in-place is greater than value
adjust.analog.move.horizontal.time.lessfloatAnalog looking left-right adjustment time is less than value in seconds
adjust.analog.move.horizontal.time.greaterfloatAnalog looking left-right adjustment time is greater than value in seconds
adjust.analog.move.horizontal.range.lessfloatAnalog looking left-right adjustment range is less than value
adjust.analog.move.horizontal.range.greaterfloatAnalog looking left-right adjustment range is greater than value
analog.move.horizontal.goalfloatAnalog looking left-right value goal to check
analog.move.horizontal.goal.lessfloatDifference between analog.move.horizontal.goal and analog looking left-right goal normalized to the range between -180..180 is less than value
analog.move.horizontal.goal.greaterfloatDifference between analog.move.horizontal.goal and analog looking left-right goal normalized to the range between -180..180 is greater than value
analog.move.horizontalfloatAnalog looking left-right value to check
analog.move.horizontal.lessfloatDifference between analog.move.horizontal and analog looking left-right goal normalized to the range between -180..180 is less than value
analog.move.horizontal.lessfloatDifference between analog.move.horizontal and analog looking left-right goal normalized to the range between -180..180 is greater than value
analog.move.speed.lessfloatAnalog moving speed is less than value
analog.move.speed.greaterfloatAnalog moving speed is greater than value
is.movingtrue, falseActor is moving direct or analog matches value
move.speed.lessfloatMoving speed is less than value in meters per second
move.speed.greaterfloatMoving speed is greater than value in meters per second
move.speed.absolute.lessfloatAbsolute moving speed is less than value in meters per second
move.speed.absolute.greaterfloatAbsolute moving speed is greater than value in meters per second
adjust.linearVelocity.time.lessfloatLinear velocity adjustment time is less than value in seconds
adjust.linearVelocity.time.greaterfloatLinear velocity adjustment time is greater than value in seconds
adjust.linearVelocity.range.lessfloatLinear velocity adjustment range is less than value in meters per second
adjust.linearVelocity.range.greaterfloatLinear velocity adjustment range is greater than value in meters per second
move.orientationfloatMovement orientation in world space to check
move.orientation.lessfloatDifference between move.orientation and movement orientation in world space normalized to the range between -180..180 is less than value
move.orientation.greaterfloatDifference between move.orientation and movement orientation in world space normalized to the range between -180..180 is greaterless than value
move.direction.lessfloatMovement direction relative to view orientation is less than value in degrees
move.direction.greaterfloatMovement direction relative to view orientation is greater than value in degrees
reset.time.walktrue, falseWalk/run time linked controllers have to be reset matches value
adjust.stance.time.lessfloatAdjustment time for stance is less than value in seconds
adjust.stance.time.greaterfloatAdjustment time for stance is greater than value in seconds
adjust.stance.range.lessfloatAdjustment range for stance is less than value
adjust.stance.range.greaterfloatAdjustment range for stance is greater than value
stance.lessfloatStance value is less than value
stance.greaterfloatStance value is greater than value
stance.goal.lessfloatStance goal value is less than value
stance.goal.greaterfloatStance goal value is greater than value
can.tilttrue, falseActor can tilt the body matches value
tilt.modenone, single, weightedTilt mode matches value
tilt.mode.notnone, single, weightedTilt mode does not match value
limit.tilt.up.lessfloatTilt up limit is less than value in degrees
limit.tilt.up.greaterfloatTilt up limit is greater than value in degrees
limit.tilt.down.lessfloatTilt down limit is less than value in degrees
limit.tilt.down.greaterfloatTilt down limit is greater than value in degrees
tilt.vertical.lessfloatCurrent tilt up/down angle is less than value in degrees
tilt.vertical.greaterfloatCurrent tilt up/down angle is greater than value in degrees
tilt.vertical.goal.lessfloatGoal tilt up/down angle is less than value in degrees
tilt.vertical.goal.greaterfloatGoal tilt up/down angle is greater than value in degrees
adjust.tilt.vertical.time.lessfloatTilt up/down adjust time is less than value in seconds
adjust.tilt.vertical.time.greaterfloatTilt up/down adjust time is greater than value in seconds
adjust.tilt.vertical.range.lessfloatTilt up/down adjust range is less than value
adjust.tilt.vertical.range.greaterfloatTilt up/down adjust range is greater than value
limit.tilt.left.lessfloatTilt left limit is less than value in degrees
limit.tilt.left.greaterfloatTilt left limit is greater than value in degrees
limit.tilt.right.lessfloatTilt right limit is less than value in degrees
limit.tilt.right.greaterfloatTilt right limit is greater than value in degrees
tilt.horizontal.lessfloatCurrent tilt left/right angle less than value in degrees
tilt.horizontal.greaterfloatCurrent tilt left/right angle greater than value in degrees
tilt.horizontal.goal.lessfloatGoal tilt left/right angle is less than value in degrees
tilt.horizontal.goal.greaterfloatGoal tilt left/right angle is greater than value in degrees
adjust.tilt.horizontal.time.lessfloatTilt left/right adjust time is less than value in seconds
adjust.tilt.horizontal.time.greaterfloatTilt left/right adjust time is greater than value in seconds
adjust.tilt.horizontal.range.lessfloatTilt left/right adjust range is less than value
adjust.tilt.horizontal.range.greaterfloatTilt left/right adjust range is greater than value
tilt.offset.lessfloatTilt offset is less than value in meters
tilt.offset.greaterfloatTilt offset is greater than value in meters
wait If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled

This is an example of using this action:

<sequence>
  <action name='locomotion.check'>
    <parameter name='enabled'>true</parameter>
  </action>
  <!-- actions here run only if locomotion is enabled -->
</sequence>

Behavior Tree Conditions

This behavior adds these behavior tree conditions if behavior tree is present.

locomotion.check

Check one or more locomotion parameters. Conditions returns true if all parameter value match their respective locomotion parameter. This condition is typically used to run an action or sequence of actions as long as locomotion conditions are true.

ParameterValueDescription
locomotion.can.turntrue, falseActor can turn matches value
locomotion.alwaysLimitLeftRighttrue, falseLook left/right is always limited matches value
locomotion.limit.look.up.lessfloatLooking up limit angle is less than value in degrees
locomotion.limit.look.up.greaterfloatLooking up limit angle is greater than value in degrees
locomotion.limit.look.down.lessfloatLooking down limit angle is less than value in degrees
locomotion.limit.look.down.greaterfloatLooking down limit angle is greater than value in degrees
locomotion.adjust.vertical.time.lessfloatLook up-down adjustment time is less than value in seconds
locomotion.adjust.vertical.time.greaterfloatLook up-down adjustment time is greater than value in seconds
locomotion.adjust.vertical.range.lessfloatLook up-down adjustment range is less than value
locomotion.adjust.vertical.range.greaterfloatLook up-down adjustment range is greater than value
locomotion.look.vertical.goal.lessfloatLooking up-down goal is less than value
locomotion.look.vertical.goal.greaterfloatLooking up-down goal is greater than value
locomotion.look.vertical.lessfloatLooking up-down value is less than value
locomotion.look.vertical.greaterfloatLooking up-down value is greater than value
locomotion.limit.look.left.lessfloatLooking left limit is less than value in degrees
locomotion.limit.look.left.greaterfloatLooking left limit is greater than value in degrees
locomotion.limit.look.right.lessfloatLooking right limit is less than value in degrees
locomotion.limit.look.right.greaterfloatLooking right limit is greater than value in degrees
locomotion.adjust.horizontal.time.lessfloatLook left-right adjustment time is less than in seconds
locomotion.adjust.horizontal.time.greaterfloatLook left-right adjustment time is greater than in seconds
locomotion.adjust.horizontal.range.lessfloatLook left-right adjustment range is less than value
locomotion.adjust.horizontal.range.greaterfloatLook left-right adjustment range is greater than value
locomotion.look.horizontal.goal.lessfloatLook left-right goal is less than value
locomotion.look.horizontal.goal.greaterfloatLook left-right goal is greater than value
locomotion.look.horizontal.lessfloatLook left-right value is less than value
locomotion.look.horizontal.greaterfloatLook left-right value is greater than value
locomotion.analog.vertical.lessfloatAnalog looking up-down is less than value
locomotion.analog.vertical.greaterfloatAnalog looking up-down is greater than value
locomotion.turn.horizontal.lessfloatTurn left-right value is less than value
locomotion.turn.horizontal.greaterfloatTurn left-right value is greater than value
locomotion.adjust.orientation.time.lessfloatOrientation adjustment time is less than value in seconds
locomotion.adjust.orientation.time.greaterfloatOrientation adjustment time is greater than value in seconds
locomotion.orientationfloatActor orientation to check
locomotion.orientation.lessfloatDifference between orientation and actor orientation normalized to the range between -180..180 is less than value
locomotion.orientation.greaterfloatDifference between orientation and actor orientation normalized to the range between -180..180 is greaterless than value
locomotion.turn.speed.lessfloatTurning speed is less than value in meters per second
locomotion.turn.speed.greaterfloatTurning speed is greater than value in meters per second
locomotion.is.turning.inplacetrue, falseActor is turning in place matches value
locomotion.adjust.turn.inplace.time.lessfloatAdjustment time is less than value in seconds for turning in-place
locomotion.adjust.turn.inplace.time.greaterfloatAdjustment time is greater than value in seconds for turning in-place
locomotion.turn.inplace.lessfloatTurn in place value is less than value
locomotion.turn.inplace.greaterfloatTurn in place value is greater than value
locomotion.reset.time.turn.inplacetrue, falseTurn in place time linked controllers have to be reset matches value
locomotion.reverse.time.turn.inplacetrue, falseTurn in place time linked controllers have to be reversed matches value
locomotion.can.turn.inplacetrue, falseActor can turn in-place if looking beyond limits matches value
locomotion.limit.turn.inplace.left.lessfloatLooking left limit in degrees before turning in-place is less than value
locomotion.limit.turn.inplace.left.greaterfloatLooking left limit in degrees before turning in-place is greater than value
locomotion.limit.turn.inplace.right.lessfloatLooking right limit in degrees before turning in-place is less than value
locomotion.limit.turn.inplace.right.greaterfloatLooking right limit in degrees before turning in-place is greater than value
locomotion.adjust.analog.move.horizontal.time.lessfloatAnalog looking left-right adjustment time is less than value in seconds
locomotion.adjust.analog.move.horizontal.time.greaterfloatAnalog looking left-right adjustment time is greater than value in seconds
locomotion.adjust.analog.move.horizontal.range.lessfloatAnalog looking left-right adjustment range is less than value
locomotion.adjust.analog.move.horizontal.range.greaterfloatAnalog looking left-right adjustment range is greater than value
locomotion.analog.move.horizontal.goalfloatAnalog looking left-right value goal to check
locomotion.analog.move.horizontal.goal.lessfloatDifference between analog.move.horizontal.goal and analog looking left-right goal normalized to the range between -180..180 is less than value
locomotion.analog.move.horizontal.goal.greaterfloatDifference between analog.move.horizontal.goal and analog looking left-right goal normalized to the range between -180..180 is greater than value
locomotion.analog.move.horizontalfloatAnalog looking left-right value to check
locomotion.analog.move.horizontal.lessfloatDifference between analog.move.horizontal and analog looking left-right goal normalized to the range between -180..180 is less than value
locomotion.analog.move.horizontal.lessfloatDifference between analog.move.horizontal and analog looking left-right goal normalized to the range between -180..180 is greater than value
locomotion.analog.move.speed.lessfloatAnalog moving speed is less than value
locomotion.analog.move.speed.greaterfloatAnalog moving speed is greater than value
locomotion.is.movingtrue, falseActor is moving direct or analog matches value
locomotion.move.speed.lessfloatMoving speed is less than value in meters per second
locomotion.move.speed.greaterfloatMoving speed is greater than value in meters per second
locomotion.move.speed.absolute.lessfloatAbsolute moving speed is less than value in meters per second
locomotion.move.speed.absolute.greaterfloatAbsolute moving speed is greater than value in meters per second
locomotion.adjust.linearVelocity.time.lessfloatLinear velocity adjustment time is less than value in seconds
locomotion.adjust.linearVelocity.time.greaterfloatLinear velocity adjustment time is greater than value in seconds
locomotion.adjust.linearVelocity.range.lessfloatLinear velocity adjustment range is less than value in meters per second
locomotion.adjust.linearVelocity.range.greaterfloatLinear velocity adjustment range is greater than value in meters per second
locomotion.move.orientationfloatMovement orientation in world space to check
locomotion.move.orientation.lessfloatDifference between move.orientation and movement orientation in world space normalized to the range between -180..180 is less than value
locomotion.move.orientation.greaterfloatDifference between move.orientation and movement orientation in world space normalized to the range between -180..180 is greaterless than value
locomotion.move.direction.lessfloatMovement direction relative to view orientation is less than value in degrees
locomotion.move.direction.greaterfloatMovement direction relative to view orientation is greater than value in degrees
locomotion.reset.time.walktrue, falseWalk/run time linked controllers have to be reset matches value
locomotion.adjust.stance.time.lessfloatAdjustment time for stance is less than value in seconds
locomotion.adjust.stance.time.greaterfloatAdjustment time for stance is greater than value in seconds
locomotion.adjust.stance.range.lessfloatAdjustment range for stance is less than value
locomotion.adjust.stance.range.greaterfloatAdjustment range for stance is greater than value
locomotion.stance.lessfloatStance value is less than value
locomotion.stance.greaterfloatStance value is greater than value
locomotion.stance.goal.lessfloatStance goal value is less than value
locomotion.stance.goal.greaterfloatStance goal value is greater than value
locomotion.can.tilttrue, falseActor can tilt the body matches value
locomotion.tilt.modenone, single, weightedTilt mode matches value
locomotion.tilt.mode.notnone, single, weightedTilt mode does not match value
locomotion.limit.tilt.up.lessfloatTilt up limit is less than value in degrees
locomotion.limit.tilt.up.greaterfloatTilt up limit is greater than value in degrees
locomotion.limit.tilt.down.lessfloatTilt down limit is less than value in degrees
locomotion.limit.tilt.down.greaterfloatTilt down limit is greater than value in degrees
locomotion.tilt.vertical.lessfloatCurrent tilt up/down angle is less than value in degrees
locomotion.tilt.vertical.greaterfloatCurrent tilt up/down angle is greater than value in degrees
locomotion.tilt.vertical.goal.lessfloatGoal tilt up/down angle is less than value in degrees
locomotion.tilt.vertical.goal.greaterfloatGoal tilt up/down angle is greater than value in degrees
locomotion.adjust.tilt.vertical.time.lessfloatTilt up/down adjust time is less than value in seconds
locomotion.adjust.tilt.vertical.time.greaterfloatTilt up/down adjust time is greater than value in seconds
locomotion.adjust.tilt.vertical.range.lessfloatTilt up/down adjust range is less than value
locomotion.adjust.tilt.vertical.range.greaterfloatTilt up/down adjust range is greater than value
locomotion.limit.tilt.left.lessfloatTilt left limit is less than value in degrees
locomotion.limit.tilt.left.greaterfloatTilt left limit is greater than value in degrees
locomotion.limit.tilt.right.lessfloatTilt right limit is less than value in degrees
locomotion.limit.tilt.right.greaterfloatTilt right limit is greater than value in degrees
locomotion.tilt.horizontal.lessfloatCurrent tilt left/right angle less than value in degrees
locomotion.tilt.horizontal.greaterfloatCurrent tilt left/right angle greater than value in degrees
locomotion.tilt.horizontal.goal.lessfloatGoal tilt left/right angle is less than value in degrees
locomotion.tilt.horizontal.goal.greaterfloatGoal tilt left/right angle is greater than value in degrees
locomotion.adjust.tilt.horizontal.time.lessfloatTilt left/right adjust time is less than value in seconds
locomotion.adjust.tilt.horizontal.time.greaterfloatTilt left/right adjust time is greater than value in seconds
locomotion.adjust.tilt.horizontal.range.lessfloatTilt left/right adjust range is less than value
locomotion.adjust.tilt.horizontal.range.greaterfloatTilt left/right adjust range is greater than value
locomotion.tilt.offset.lessfloatTilt offset is less than value in meters
locomotion.tilt.offset.greaterfloatTilt offset is greater than value in meters

This is an example of using this condition:

<action name='myAction' id='doing something'>
  <parameter name='locomotion.enabled'>true</parameter>
  <condition>locomotion.check</condition>
</action>

State Machine Actions

State Machine Conditions

State Machine Events

This behavior sends no state machine events.

Required Behaviors

Optional Behaviors

Persistency

This behavior does support element class to be persistable (setPersistable). Saves locomotion state.

API Documentation

ECBehaviorLocomotion.

Since DragonScript Module Version 1.0

Use Cases

  • Add support for FPS/natural type locomotion to human/creature actors.
  • Add support for vehicle type locomotion to vehicles.

Element Class Example

This example defines an element which supports locomotion for actors. For vehicles omit ECBehaviorColliderAI and use ECBehaviorCollider instead.

class MyElement extends BehaviorElementClass
  public var ECBehaviorComponent component
  public var ECBehaviorCollider collider
  public var ECBehaviorColliderAI colliderAI
  public var ECBehaviorLocomotion locomotion
  func new()
    component = ECBehaviorComponent.new(this, null)
    collider = ECBehaviorCollider.new(this, component)
    colliderAI = ECBehaviorColliderAI.new(this, collider)
    locomotion = ECBehaviorLocomotion.new(this, colliderAI)
  end
end

Behavior Factory

Using element class supporting adding behaviors the behavior can be added like this:

<?xml version='1.0' encoding='UTF-8'?>
<elementClass name='MyClass' class='GenericBehaviorElement'>
  <behavior type='ECBehaviorComponent'/>
  <behavior type='ECBehaviorCollider'/>
 
  <!-- for vehicles omit this line to use ECBehaviorCollider instead -->
  <behavior type='ECBehaviorColliderAI'/>
 
  <behavior type='ECBehaviorLocomotion'>
    <!-- optional: add behavior trees. default adds all behavior trees. -->
    <list name='behaviorTrees'>
      <string/> <!-- add behavior with empty identifier -->
      <string>default</string> <!-- add behavior with 'default' identifier -->
    </list>
 
    <!-- optional: add state machines. default adds all state machines. -->
    <list name='stateMachines'>
      <string/> <!-- add behavior with empty identifier -->
      <string>default</string> <!-- add behavior with 'default' identifier -->
    </list>
 
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <string name='.name'>value</string>
  </behavior>
</elementClass>

Live Examples

You could leave a comment if you were logged in.
dragengine/modules/dragonscript/behavior_locomotion.txt · Last modified: 2025/05/14 14:12 by dragonlord