User Tools

Site Tools


dragengine:modules:dragonscript:behavior_grabber

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_grabber [2025/05/02 13:34] – dragonlorddragengine:modules:dragonscript:behavior_grabber [2026/10/09 16:35] (current) – dragonlord
Line 24: Line 24:
 Element class properties have the prefix ''grabber.'' or ''grabber(id).'' if id is not empty. Element class properties have the prefix ''grabber.'' or ''grabber(id).'' if id is not empty.
  
-===== shape ===== +===== bone ===== 
-Shape of collider used to detect grab spots. +Name of bone to attach to or empty string to attach to the parent element. 
-  * Full name: ''grabber.shape'' or ''grabber(id).shape'' +  * Full name: ''grabber.bone'' or ''grabber(id).bone'' 
-  * Type: string (shape format). See "Shape List Encoding" in CodecPropertyString.+  * Type: string
   * Default Value: empty string   * Default Value: empty string
-  * Example (*.deeclass): <code xml><string name='grabber(right).shape'>box:extends,0.1,0.1,0.1</string></code>+  * Example (*.deeclass): <code xml><string name='grabber(right).bone'>attach hand.r</string></code> 
 + 
 +===== collisionFilter ===== 
 + 
 +Set [[gamedev:collisionfiltering|collision filter]]. Filter bits are defined using a list of names mapped to collision filter bit indices using BaseGameApp.getCollisionFilterMap().  
 +  * Full name: ''collider.collisionFilter'' 
 +  * Type: string. Format can be ''category:filter'' or ''category'' where category and filter can be ''bit1 bit2 ... bitN'' with bit names looked up using the collision filter map. If only category is used filter is the same. 
 +  * Default Value: ''trigger:dynamic'' 
 +  * Example (*.deeclass) <code xml><string name='collider.collisionFilter'>trigger:dynamic particle</string></code>
  
 ===== position ===== ===== position =====
Line 45: Line 53:
   * Example (*.deeclass): <code xml><vector name='grabber(right).rotation' x='-45' y='0' z='0'/></code>   * Example (*.deeclass): <code xml><vector name='grabber(right).rotation' x='-45' y='0' z='0'/></code>
  
-===== bone ===== +===== shape ===== 
-Name of bone to attach to or empty string to attach to the parent element. +Shape of collider used to detect grab spots. 
-  * Full name: ''grabber.bone'' or ''grabber(id).bone'' +  * Full name: ''grabber.shape'' or ''grabber(id).shape'' 
-  * Type: string+  * Type: string (shape format). See "Shape List Encoding" in CodecPropertyString.
   * Default Value: empty string   * Default Value: empty string
-  * Example (*.deeclass): <code xml><string name='grabber(right).bone'>attach hand.r</string></code>+  * Example (*.deeclass): <code xml><string name='grabber(right).shape'>box:extends,0.1,0.1,0.1</string></code>
  
 ====== Events ====== ====== Events ======
Line 77: Line 85:
  
 Grabber enabled changed. Grabber enabled changed.
 +
 ====== Behavior Tree Actions ====== ====== Behavior Tree Actions ======
  
 This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace ''grabber'' with ''grabber(id)''. This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace ''grabber'' with ''grabber(id)''.
  
-===== grabber.release =====+===== grabber.set =====
  
-Release grab spot if grabbing one.+Set one or more grabber parameters. 
 + 
 +^Parameter^Value^Description^ 
 +|enabled|''true'', ''false''|Grabber is enabled|
  
 This is an example of using this action: This is an example of using this action:
 <code xml> <code xml>
-<action name='grabber.release'/>+<action name='grabber.set'> 
 +  <parameter name='enabled'>true</parameter> 
 +</action> 
 +</code> 
 + 
 +===== grabber.update ===== 
 + 
 +Update grabber. 
 + 
 +^Parameter^Value^Description^ 
 +|release| |Release grab spot if grabbing one.| 
 +|interactElement.assign|string|Assign grab spot element to [[behavior_interactelement|ECBehaviorInteractElement]] with identifier matching value string. Action fails if no element is grabbed or interact element behavior is absent| 
 +|interact|string|Interact with grab spot. 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='grabber.update'> 
 +  <parameter name='release'/> 
 +</action>
 </code> </code>
  
Line 95: Line 126:
  
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
 +|enabled|''true'', ''false''|Grabber is enabled|
 |grabbing|''true'', ''false''|Grabber is grabbing a grab spot| |grabbing|''true'', ''false''|Grabber is grabbing a grab spot|
 +|interact.name|string|Name of interaction|
 +|interact.has|''true'', ''false''|Has grab spot and interaction with name ''interaction.name'' is present|
 +|interact.query|''true'', ''false''|Interact with grab spot and test result. Condition is true if grab spot 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: This is an example of using this action:
Line 116: Line 153:
  
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
 +|grabber.enabled|''true'', ''false''|Grabber is enabled|
 |grabber.grabbing|''true'', ''false''|Grabber is grabbing a grab spot| |grabber.grabbing|''true'', ''false''|Grabber is grabbing a grab spot|
 +|grabber.interact.name|string|Name of interaction|
 +|grabber.interact.has|''true'', ''false''|Has grab spot and interaction with name ''interaction.name'' is present|
 +|grabber.interact.query|''true'', ''false''|Interact with grab spot and test result. Condition is true if grab spot 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).|
 +|grabber.interact.parameters|string|Optional parameters to use with ''interaction.query''.|
  
 This is an example of using this condition: This is an example of using this condition:
Line 125: Line 167:
 </action> </action>
 </code> </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 ''grabber'' with ''grabber(id)''.
 +
 +===== grabber.enabled =====
 +
 +Grabber has been enabled.
 +
 +===== grabber.disabled =====
 +
 +Grabber has been disabled.
 +
 +===== grabber.grabbed =====
 +
 +Grabber grabbed grab spot.
 +
 +===== grabber.released =====
 +
 +Grabber released grab spot.
 +
 +===== grabber.touch =====
 +
 +Start touching grab spot.
 +
 +===== grabber.untouch =====
 +
 +Stop touching grab spot.
  
 ====== Required Behaviors ====== ====== Required Behaviors ======
Line 135: Line 213:
   * [[behavior_vrhand|ECBehaviorVRHand]]: If used attaches grab spot touch collider to VR hand collider   * [[behavior_vrhand|ECBehaviorVRHand]]: If used attaches grab spot touch collider to VR hand collider
   * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: Add actions and conditions for behavior trees to use.   * [[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 194: Line 273:
     <string name='vrHand'>right</string>     <string name='vrHand'>right</string>
          
-    <!-- optional: set collision filter. default value '4:1' which means +    <!-- optional: use behavior tree with id instead of empty string --> 
-                   category BaseGameApp.CollisionFilterBit.trigger +    <string name='behaviorTree'>second</string> 
-                   filter BaseGameApp.CollisionFilterBit.dynamic. +     
-                   format is '', 'category' or 'category:filter' where category and filter +    <!-- optional: use state machine with id instead of empty string --> 
-                   are a list of bits to set. --> +    <string name='stateMachine'>second</string>
-    <string name='collisionFilter'>4:1 2</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_grabber.1746192870.txt.gz · Last modified: by dragonlord