User Tools

Site Tools


dragengine:modules:dragonscript:behavior_footstepconfig

ECBehaviorFootStepConfig

Behavior adding a single foot step configuration with a list of events. Optionally a list of sounds can be defined which is assigned to the events. All events share the same sounds and play sound parameters.

Instance Counts

Multiple ECBehaviorFootStepConfig to add multiple foot step configurations.

Element Class Properties

Element class properties have the prefix footStepConfig. or footStepConfig({id}). if id is not empty.

configId

Set identifier of configuration.

  • Full name: footStepConfig.configId or footStepConfig({id}).configId
  • Type: string
  • Default Value: empty string
  • Example (*.deeclass)
    <string name='footStepConfig.configId'>walk</string>

interval

Set interval in seconds between repeating foot steps.

  • Full name: camera.interval or camera({id}).interval
  • Type: float
  • Default Value: 1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='camera.interval'>0.6</value>

controllerName

Set actor animated controller name to use as elapsed time. Typically a controller updated by the moved distance is used. This allows to synchronize foot steps to animations easily. Keep in mind that event times are measured in the range from 0 to 1 instead of seconds if a controller is used. This allows animations of different length to be used with the same configuration.

  • Full name: footStepConfig.controllerName or footStepConfig({id}).controllerName
  • Type: string
  • Default Value: empty string
  • Example (*.deeclass)
    <string name='footStepConfig.controllerName'>walking</string>

sounds

List of path of sound resource to randomly choose from.

  • Full name: footStepConfig.sounds or footStepConfig({id}).sounds
  • Type: string
  • Default Value: empty string
  • Expected File Type: *.ogg (all sound modules)
  • Example (*.deeclass)
    <list name='footStepConfig.sounds'>
      <string>step1.ogg</string>
      <string>step2.ogg</string>
    </list>

volume

Set volume of foot step sound played.

  • Full name: footStepConfig.volume or footStepConfig({id}).volume
  • Type: float
  • Default Value: 1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='footStepConfig.volume'>0.2</value>

range

Set range of foot step sound played.

  • Full name: footStepConfig.range or footStepConfig({id}).range
  • Type: float
  • Default Value: 10
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='footStepConfig.range'>10</value>

rollOff

Set rollOff of foot step sound played. Determines of quickly the sound volume diminishes towards the range. Value is in the range from 0 to 1 with 0.1 being a natural roll-off

  • Full name: footStepConfig.rollOff or footStepConfig({id}).rollOff
  • Type: float
  • Default Value: 0.5
  • Restriction: At least 0 and at most 1
  • Example (*.deeclass)
    <float name='footStepConfig.rollOff'>0.5</value>

offset

Offset relative to element position to play sound at.

  • Full name: footStepConfig.offset or footStepConfig({id}).offset
  • Type: 3-component float vector
  • Default Value: (0, 0.05, 0)
  • Example (*.deeclass)
    <vector name='footStepConfig.offset' x='0' y='0.05' z='0'/>

type

Set custom type identifier. Optional value which can be used by behaviors to play custom tailored sounds.

  • Full name: footStepConfig.type or footStepConfig({id}).type
  • Type: string
  • Default Value: empty string
  • Example (*.deeclass)
    <string name='footStepConfig.type'>stone</string>

eventTimes

List of event times. For each list entry an event is added to the configuration using the properties outline above. If controllerName is empty the times are in seconds. If controllerName is not empty the times are in the range from 0 to 1 representing relative time values across the controller value range. Event time values must be in increasing order.

  • Full name: footStepConfig.eventTimes or footStepConfig({id}).eventTimes
  • Type: string
  • Default Value: empty string
  • Expected File Type: *.ogg (all sound modules)
  • Example (*.deeclass)
    <list name='footStepConfig.eventTimes'>
      <float>0.2</float>
      <float>0.6</float>
    </list>

Events

This behavior provides no events.

Required Behaviors

This behavior requires no other behaviors.

Optional Behaviors

Persistency

This behavior does not require element class persistency (setPersistable).

API Documentation

ECBehaviorFootStepConfig.

Since DragonScript Module Version 1.26

Use Cases

  • Add foot step configuration to play with foot step behavior

Element Class Example

This example defines an element which two foot step configurations.

class MyElement extends BehaviorElementClass
  public var ECBehaviorFootSteps footSteps
  public var ECBehaviorFootStepConfig footStepsWalk, footStepsRun
  func new()
    footSteps = ECBehaviorFootSteps.new(this)
    footStepsWalk = ECBehaviorFootStepConfig.new(this, footSteps, "walk")
    footStepsWalk.getInterval().setValue(0.6)
    footStepsRun = ECBehaviorFootStepConfig.new(this, footSteps, "run")
    footStepsRun.getInterval().setValue(0.4)
  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='ECBehaviorFootSteps'/>
 
  <behavior type='ECBehaviorFootStepConfig' id='walk'>
    <!-- behavior factory automatically assigns all required behaviors -->
 
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <string name='.configId'>walk</string>
    <float name='.interval'>0.6</float>
    <float name='.volume'>0.2</float>
    <float name='.range'>20</float>
    <list name='.sounds'>
      <string>/content/sound/footstep1.ogg</string>
      <string>/content/sound/footstep2.ogg</string>
    </list>
    <list name='.eventTimes'>
      <float>0.5</float>
    </list>
  </behavior>
 
  <behavior type='ECBehaviorFootStepConfig' id='run'>
    ...
  </behavior>
</elementClass>

Live Examples

You could leave a comment if you were logged in.
dragengine/modules/dragonscript/behavior_footstepconfig.txt · Last modified: 2025/05/06 20:01 by dragonlord