User Tools

Site Tools


dragengine:modules:dragonscript:bahevior_playerinputmove

ECBehaviorPlayerInputMove

Behavior element behavior adding moving player input.

Keeps track of moving player input and applies them to actor locomotion. The type of locomotion can be set to one of three typical configurations.

This behavior can be used for human actor and vehicle movement.

Instance Counts

This behavior can be used only once on an element.

Element Class Properties

Element class properties have the prefix playerInputMove. .

speedWalk

Set walk speed in meters per second.

  • Full name: playerInputMove.speedWalk
  • Type: float
  • Default Value: 1.25
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='playerInputMove.speedWalk'>1.5</float>

speedRun

Set run speed in meters per second.

  • Full name: playerInputMove.speedRun
  • Type: float
  • Default Value: 4
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='playerInputMove.speedRun'>6</float>

speedFactorWalkForward

Set speed factor walking forward.

  • Full name: playerInputMove.speedFactorWalkForward
  • Type: float
  • Default Value: 1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='playerInputMove.speedFactorWalkForward'>6</float>

speedFactorWalkBackward

Set speed factor walking backward.

  • Full name: playerInputMove.speedFactorWalkBackward
  • Type: float
  • Default Value: 1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='playerInputMove.speedFactorWalkBackward'>6</float>

speedFactorWalkLeft

Set speed factor walking left.

  • Full name: playerInputMove.speedFactorWalkLeft
  • Type: float
  • Default Value: 1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='playerInputMove.speedFactorWalkLeft'>6</float>

speedFactorWalkRight

Set speed factor walking right.

  • Full name: playerInputMove.speedFactorWalkRight
  • Type: float
  • Default Value: 1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='playerInputMove.speedFactorWalkRight'>6</float>

speedFactorRunForward

Set speed factor running forward.

  • Full name: playerInputMove.speedFactorRunForward
  • Type: float
  • Default Value: 1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='playerInputMove.speedFactorRunForward'>6</float>

speedFactorRunBackward

Set speed factor running backward.

  • Full name: playerInputMove.speedFactorRunBackward
  • Type: float
  • Default Value: 1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='playerInputMove.speedFactorRunBackward'>6</float>

speedFactorRunLeft

Set speed factor running left.

  • Full name: playerInputMove.speedFactorRunLeft
  • Type: float
  • Default Value: 1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='playerInputMove.speedFactorRunLeft'>6</float>

speedFactorRunRight

Set speed factor running right.

  • Full name: playerInputMove.speedFactorRunRight
  • Type: float
  • Default Value: 1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='playerInputMove.speedFactorRunRight'>6</float>

Events

This behavior has no events.

Required Behaviors

This behavior requires no other behaviors.

Optional Behaviors

Persistency

This behavior does not required element class to be persistable (setPersistable).

API Documentation

ECBehaviorPlayerInputMove.

Since DragonScript Module Version 1.0

Use Cases

  • Track player moving input and apply it to locomotion.

Element Class Example

This example defines an element which tracks player moving input.

class MyElement extends BehaviorElementClass
  public var ECBehaviorPlayerInputMove playerInputMove
  func new()
    playerInputMove = ECBehaviorPlayerInputMove.new(this)
  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='ECBehaviorPlayerInputMove'>
    <!-- optional: set locomotion type. default is 'natural'. allowed values are these:
                   natural: default locomotion working best for actors moving in a
                            natural way. The actor moves into the direction it is
                            looking. The body is oriented into the walking
                            direction if the actor is moving.
                   fps: configuration useful for FPS type games where the actor is always
                        oriented into the direction the player is looking. This
                        configuration typically uses an 8-direction animator representing
                        the actor moving into any direction relative to the looking direction.
                   vehicle: configuration useful for vehicle type actors like tanks which
                            move into the direction their body is oriented while allowing
                            to freely look around. -->
    <string name='locomotionType'>natural</string>
 
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <string name='.name'>Color 1</string>
  </behavior>
</elementClass>

Live Examples

You could leave a comment if you were logged in.
dragengine/modules/dragonscript/bahevior_playerinputmove.txt · Last modified: 2025/03/13 12:01 by dragonlord