User Tools

Site Tools


dragengine:modules:dragonscript:behavior_touchsensor

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_touchsensor [2025/05/04 13:50] – [touchSensor.check] dragonlorddragengine:modules:dragonscript:behavior_touchsensor [2026/11/20 16:51] (current) – [touchSensor.set] dragonlord
Line 30: Line 30:
  
 Element class properties have the prefix ''touchSensor.'' or ''touchSensor({id}).'' if id is not empty. Element class properties have the prefix ''touchSensor.'' or ''touchSensor({id}).'' if id is not empty.
 +
 +===== bone =====
 +
 +Bone to attach resource to. If empty string attach to collider.
 +
 +  * Full name: ''touchSensor.bone'' or ''touchSensor({id}).bone''
 +  * Type: string
 +  * Default Value: empty string
 +  * Example (*.deeclass) <code xml><string name='touchSensor.bone'>attach</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:actorAI''
 +  * Example (*.deeclass) <code xml><string name='collider.collisionFilter'>trigger:actorAI particle</string></code>
 +
 +===== orientation =====
 +
 +Orientation to attach resource to collider in degrees.
 +
 +  * Full name: ''touchSensor.orientation'' or ''touchSensor({id}).orientation''
 +  * Type: 3-component float vector
 +  * Default Value: (0,0,0)
 +  * Example (*.deeclass) <code xml><vector name='touchSensor.orientation' x='30' y='0' z='0'/></code>
 +
 +===== position =====
 +
 +Position to attach resource to collider.
 +
 +  * Full name: ''touchSensor.position'' or ''touchSensor({id}).position''
 +  * Type: 3-component float vector
 +  * Default Value: (0,0,0)
 +  * Example (*.deeclass) <code xml><vector name='touchSensor.position' x='0' y='0' z='0.1'/></code>
  
 ===== shape ===== ===== shape =====
Line 57: Line 92:
   * Default Value: ''true''   * Default Value: ''true''
   * Example (*.deeclass) <code xml><boolean name='touchSensor.touching'>false</boolean></code>   * Example (*.deeclass) <code xml><boolean name='touchSensor.touching'>false</boolean></code>
- 
-===== position ===== 
- 
-Position to attach resource to collider. 
- 
-  * Full name: ''touchSensor.position'' or ''touchSensor({id}).position'' 
-  * Type: 3-component float vector 
-  * Default Value: (0,0,0) 
-  * Example (*.deeclass) <code xml><vector name='touchSensor.position' x='0' y='0' z='0.1'/></code> 
- 
-===== orientation ===== 
- 
-Orientation to attach resource to collider in degrees. 
- 
-  * Full name: ''touchSensor.orientation'' or ''touchSensor({id}).orientation'' 
-  * Type: 3-component float vector 
-  * Default Value: (0,0,0) 
-  * Example (*.deeclass) <code xml><vector name='touchSensor.orientation' x='30' y='0' z='0'/></code> 
- 
-===== bone ===== 
- 
-Bone to attach resource to. If empty string attach to collider. 
- 
-  * Full name: ''touchSensor.bone'' or ''touchSensor({id}).bone'' 
-  * Type: string 
-  * Default Value: empty string 
-  * Example (*.deeclass) <code xml><string name='touchSensor.bone'>attach</string></code> 
  
 ====== Events ====== ====== Events ======
Line 108: Line 116:
  
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
 +|collisionFilter.filter.set|string|Set named [[gamedev:collisionfiltering|collision filter]] filter mask bit.|
 +|collisionFilter.filter.clear|string|Clear named [[gamedev:collisionfiltering|collision filter]] filter mask bit.|
 |enabled|''true'', ''false''|Enable touch sensor| |enabled|''true'', ''false''|Enable touch sensor|
  
Line 114: Line 124:
 <action name='touchSensor.set'> <action name='touchSensor.set'>
   <parameter name='enabled'>true</parameter>   <parameter name='enabled'>true</parameter>
 +</action>
 +</code>
 +
 +===== touchSensor.update =====
 +
 +Update touch sensor.
 +
 +^Parameter^Value^Description^
 +|touching.runEvent|string|Run state machine event on all touching elements supporting [[behavior_statemachine|ECBehaviorStateMachine]]|
 +
 +This is an example of using this action:
 +<code xml>
 +<action name='touchSensor.update'>
 +  <parameter name='touching.runEvent'>effect.jump</parameter>
 </action> </action>
 </code> </code>
Line 176: Line 200:
 ===== touchSensor.entered ===== ===== touchSensor.entered =====
  
-Element entered touch sensor.+Element entered touch sensor. Element is send as event parameter. Use [[behavior_statemachine#eventelementupdate|eventParameter.update]] or [[behavior_statemachine#eventelementcheck|eventParameter.check]] to work with the element.
  
 ===== touchSensor.left ===== ===== touchSensor.left =====
  
-Element left touch sensor.+Element left touch sensor. Element is send as event parameter. Use [[behavior_statemachine#eventelementupdate|eventParameter.update]] or [[behavior_statemachine#eventelementcheck|eventParameter.check]] to work with the element.
  
 ====== Required Behaviors ====== ====== Required Behaviors ======
Line 233: Line 257:
      
   <behavior type='ECBehaviorTouchSensor'>   <behavior type='ECBehaviorTouchSensor'>
-    <!-- optional: set collision filter. default value '4:3' which means 
-                   category BaseGameApp.CollisionFilterBit.trigger 
-                   filter BaseGameApp.CollisionFilterBit.actorAI. 
-                   format is '', 'category' or 'category:filter' where category and filter 
-                   are a list of bits to set. --> 
-    <string name='collisionFilter'>3:4 0</string> 
-     
     <!-- optional: use behavior tree with id instead of empty string -->     <!-- optional: use behavior tree with id instead of empty string -->
     <string name='behaviorTree'>second</string>     <string name='behaviorTree'>second</string>
dragengine/modules/dragonscript/behavior_touchsensor.1746366623.txt.gz · Last modified: by dragonlord