User Tools

Site Tools


dragengine:modules:dragonscript:behavior_avoidcollision

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dragengine:modules:dragonscript:behavior_avoidcollision [2025/03/12 19:38] – [Optional Behaviors] dragonlorddragengine:modules:dragonscript:behavior_avoidcollision [2025/05/04 23:16] (current) dragonlord
Line 1: Line 1:
 {{tag>dragonscript behavior}} {{tag>dragonscript behavior}}
 <WRAP youarehere> <WRAP youarehere>
-[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorAvoidCollision**+[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorAvoidCollision**
 </WRAP> </WRAP>
  
Line 32: Line 32:
  
 ====== Events ====== ====== Events ======
 +
 This behavior has no events. This behavior has no events.
 +
 +====== Behavior Tree Actions ======
 +
 +This behavior adds these behavior tree actions if behavior tree is present.
 +
 +===== avoidCollision.set =====
 +
 +Set one or more force field parameters.
 +
 +^Parameter^Value^Description^
 +|waitBehindObstacles|''true'', ''false''|Wait behind obstacles instead of moving around them|
 +|enabled|''true'', ''false''|Enable avoid collision|
 +
 +This is an example of using this action:
 +<code xml>
 +<action name='avoidCollision.set'>
 +  <parameter name='enabled'>true</parameter>
 +</action>
 +</code>
 +
 +===== avoidCollision.stop =====
 +
 +Stop avoiding collision.
 +
 +This is an example of using this action:
 +<code xml>
 +<action name='avoidCollision.stop'/>
 +</code>
 +
 +===== avoidCollision.check =====
 +
 +Check one or more force field parameters. Action succeeds if all parameter value matches their respective force field parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a force field parameter matches (or not).
 +
 +^Parameter^Value^Description^
 +|waitBehindObstacles|''true'', ''false''|Wait behind obstacles instead of moving around them|
 +|enabled|''true'', ''false''|Avoid collision is enabled or not|
 +|avoiding|''true'', ''false''|In progress of avoiding a collision|
 +|avoiding.time.less|float|Ramining time avoiding collision is less than value seconds|
 +|avoiding.time.greater|float|Ramining time avoiding collision is greater than value seconds|
 +|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:
 +<code xml>
 +<sequence>
 +  <action name='avoidCollision.check'>
 +    <parameter name='avoiding'>true</parameter>
 +  </action>
 +  <!-- actions here run only if actor is avoiding a collision -->
 +</sequence>
 +</code>
 +
 +====== Behavior Tree Conditions ======
 +
 +This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace ''avoidCollision'' with ''avoidCollision(id)''.
 +
 +===== avoidCollision.check =====
 +
 +Check one or more force field parameters. Conditions returns true if all parameter value match their respective force field parameter. This condition is typically used to run an action or sequence of actions as long as force field conditions are true.
 +
 +^Parameter^Value^Description^
 +|avoidCollision.waitBehindObstacles|''true'', ''false''|Wait behind obstacles instead of moving around them|
 +|avoidCollision.enabled|''true'', ''false''|Avoid collision is enabled or not|
 +|avoidCollision.avoiding|''true'', ''false''|In progress of avoiding a collision|
 +|avoidCollision.avoiding.time.less|float|Ramining time avoiding collision is less than value seconds|
 +|avoidCollision.avoiding.time.greater|float|Ramining time avoiding collision is greater than value seconds|
 +
 +This is an example of using this condition:
 +<code xml>
 +<action name='myAction' id='doing something'>
 +  <parameter name='avoidCollision.avoiding'>true</parameter>
 +  <condition>avoidCollision.check</condition>
 +</action>
 +</code>
 +
 +====== State Machine Actions ======
 +
 +Same as [[#behavior_tree_actions|Behavior Tree Actions]].
 +
 +====== State Machine Conditions ======
 +
 +Same as [[#behavior_tree_conditions|Behavior Tree Conditions]].
 +
 +====== State Machine Events ======
 +
 +This behavior sends these state machine events.
 +
 +===== avoidCollision.avoid =====
 +
 +Avoid collision.
 +
 +===== avoidCollision.stop =====
 +
 +Stop avoiding collision.
  
 ====== Required Behaviors ====== ====== Required Behaviors ======
Line 41: Line 135:
  
   * [[behavior_rideon|ECBehaviorRideOn]]: Avoid while respecting ground movement.   * [[behavior_rideon|ECBehaviorRideOn]]: Avoid while respecting ground movement.
 +  * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: Add actions and conditions for behavior trees to use.
 +  * [[behavior_statemachine|ECBehaviorStateMachine]]: Add actions and conditions for state machine to use and events to send to the state machine.
  
 ====== Persistency ====== ====== Persistency ======
Line 109: Line 205:
                    are a list of bits to set. -->                    are a list of bits to set. -->
     <string name='collisionFilter'>3:0 1 2 3</string>     <string name='collisionFilter'>3:0 1 2 3</string>
 +    
 +    <!-- optional: use behavior tree with id instead of empty string -->
 +    <string name='behaviorTree'>second</string>
 +    
 +    <!-- optional: use state machine with id instead of empty string -->
 +    <string name='stateMachine'>second</string>
          
     <!-- set element properties. omit property prefix if used inside behavior tag -->     <!-- set element properties. omit property prefix if used inside behavior tag -->
dragengine/modules/dragonscript/behavior_avoidcollision.1741808338.txt.gz · Last modified: 2025/03/12 19:38 by dragonlord