User Tools

Site Tools


dragengine:modules:dragonscript:behavior_grabspot

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_grabspot [2025/03/13 17:13] dragonlorddragengine:modules:dragonscript:behavior_grabspot [2025/05/13 14:06] (current) dragonlord
Line 106: Line 106:
  
 Grab spot enabled changed. Grab spot enabled changed.
 +
 +====== Behavior Tree Actions ======
 +
 +This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace ''grabSpot'' with ''grabSpot(id)''.
 +
 +===== grabSpot.set =====
 +
 +Set one or more grab spot parameters.
 +
 +^Parameter^Value^Description^
 +|enabled|''true'', ''false''|Grab spot is enabled|
 +
 +This is an example of using this action:
 +<code xml>
 +<action name='grabSpot.set'>
 +  <parameter name='enabled'>true</parameter>
 +</action>
 +</code>
 +
 +===== grabSpot.update =====
 +
 +Update grab spot.
 +
 +^Parameter^Value^Description^
 +|release| |Release grabber if one is grabbing the grab spot.|
 +|interactElement.assign|string|Assign grabber element to [[behavior_interactelement|ECBehaviorInteractElement]] with identifier matching value string. Action fails if no element is grabbing or interact element behavior is absent|
 +|interact|string|Interact with grabber. If element is absent action fails. Runs interaction with name value. If interaction with name value is absent fails action. If interaction returns false fails action. Otherwise action succeeds.|
 +|interact.parameters|string|Optional parameters to use with ''interaction''.|
 +
 +This is an example of using this action:
 +<code xml>
 +<action name='grabSpot.update'>
 +  <parameter name='release'/>
 +</action>
 +</code>
 +
 +===== grabSpot.check =====
 +
 +Check one or more grab spot parameters. Action succeeds if all parameter value matches their respective grab spot parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a grab spot parameter matches (or not).
 +
 +^Parameter^Value^Description^
 +|enabled|''true'', ''false''|Grab spot is enabled|
 +|grabbed|''true'', ''false''|Grab spot is grabbed by a grabber|
 +|interact.name|string|Name of interaction|
 +|interact.has|''true'', ''false''|Has grabber and interaction with name ''interaction.name'' is present|
 +|interact.query|''true'', ''false''|Interact with grabber and test result. Condition is true if grabber is present, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).|
 +|interact.parameters|string|Optional parameters to use with ''interaction.query''.|
 +|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='grabSpot.check'>
 +    <parameter name='grabbed'>true</parameter>
 +  </action>
 +  <!-- actions here run only if grab spot is grabbed by a grabber -->
 +</sequence>
 +</code>
 +
 +====== Behavior Tree Conditions ======
 +
 +This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace ''grabSpot'' with ''grabSpot(id)''.
 +
 +===== grabSpot.check =====
 +
 +Check one or more grab spot parameters. Conditions returns true if all parameter value match their respective grab spot parameter. This condition is typically used to run an action or sequence of actions as long as grab spot conditions are true.
 +
 +^Parameter^Value^Description^
 +|grabSpot.enabled|''true'', ''false''|Grab spot is enabled|
 +|grabSpot.grabbed|''true'', ''false''|Grab spot is grabbed by a grabber|
 +|grabSpot.interact.name|string|Name of interaction|
 +|grabSpot.interact.has|''true'', ''false''|Has grabber and interaction with name ''interaction.name'' is present|
 +|grabSpot.interact.query|''true'', ''false''|Interact with grabber and test result. Condition is true if grabber is present, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).|
 +|grabSpot.interact.parameters|string|Optional parameters to use with ''interaction.query''.|
 +
 +This is an example of using this condition:
 +<code xml>
 +<action name='myAction' id='doing something'>
 +  <parameter name='grabSpot.grabbed'>true</parameter>
 +  <condition>grabSpot.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. If behavior has non-empty identifier replace ''grabSpot'' with ''grabSpot(id)''.
 +
 +===== grabSpot.enabled =====
 +
 +Grab spot has been enabled.
 +
 +===== grabSpot.disabled =====
 +
 +Grab spot has been disabled.
 +
 +===== grabSpot.grabbed =====
 +
 +Grabber grabbed grab spot.
 +
 +===== grabSpot.released =====
 +
 +Grabber released grab spot.
  
 ====== Required Behaviors ====== ====== Required Behaviors ======
Line 114: Line 224:
  
   * [[behavior_collider|ECBehaviorCollider]]: If used attaches grab spot touch collider to collider   * [[behavior_collider|ECBehaviorCollider]]: If used attaches grab spot touch collider to collider
 +  * [[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 165: Line 278:
                    are a list of bits to set. -->                    are a list of bits to set. -->
     <string name='collisionFilter'>4:1 2</string>     <string name='collisionFilter'>4:1 2</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_grabspot.1741886007.txt.gz · Last modified: 2025/03/13 17:13 by dragonlord