This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| dragengine:modules:dragonscript:behavior_touchsensor [2025/03/13 16:48] – dragonlord | dragengine:modules:dragonscript:behavior_touchsensor [2026/11/20 16:51] (current) – [touchSensor.set] dragonlord | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| {{tag> | {{tag> | ||
| <WRAP youarehere> | <WRAP youarehere> | ||
| - | [[: | + | [[: |
| </ | </ | ||
| Line 30: | Line 30: | ||
| Element class properties have the prefix '' | Element class properties have the prefix '' | ||
| + | |||
| + | ===== bone ===== | ||
| + | |||
| + | Bone to attach resource to. If empty string attach to collider. | ||
| + | |||
| + | * Full name: '' | ||
| + | * Type: string | ||
| + | * Default Value: empty string | ||
| + | * Example (*.deeclass) <code xml>< | ||
| + | |||
| + | ===== collisionFilter ===== | ||
| + | |||
| + | Set [[gamedev: | ||
| + | * Full name: '' | ||
| + | * Type: string. Format can be '' | ||
| + | * Default Value: '' | ||
| + | * Example (*.deeclass) <code xml>< | ||
| + | |||
| + | ===== orientation ===== | ||
| + | |||
| + | Orientation to attach resource to collider in degrees. | ||
| + | |||
| + | * Full name: '' | ||
| + | * Type: 3-component float vector | ||
| + | * Default Value: (0,0,0) | ||
| + | * Example (*.deeclass) <code xml>< | ||
| + | |||
| + | ===== position ===== | ||
| + | |||
| + | Position to attach resource to collider. | ||
| + | |||
| + | * Full name: '' | ||
| + | * Type: 3-component float vector | ||
| + | * Default Value: (0,0,0) | ||
| + | * Example (*.deeclass) <code xml>< | ||
| ===== shape ===== | ===== shape ===== | ||
| Line 58: | Line 93: | ||
| * Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
| - | ===== position | + | ====== Events ====== |
| - | Position to attach resource to collider. | + | ===== elementEntered ===== |
| - | * Full name: '' | + | Element entered touch sensor. |
| - | * Type: 3-component float vector | + | |
| - | * Default Value: (0,0,0) | + | |
| - | * Example (*.deeclass) <code xml>< | + | |
| - | ===== orientation | + | ===== elementLeft |
| - | Orientation to attach resource to collider in degrees. | + | Element left touch sensor. |
| - | * Full name: '' | + | ===== elementCanTouch ===== |
| - | * Type: 3-component float vector | + | |
| - | * Default Value: (0,0,0) | + | |
| - | * Example (*.deeclass) <code xml>< | + | |
| - | ===== bone ===== | + | Element can touch this touch sensor if all listeners return true. |
| - | Bone to attach resource to. If empty string attach to collider. | + | ====== Behavior Tree Actions ====== |
| - | * Full name: '' | + | This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace |
| - | * Type: string | + | |
| - | * Default Value: empty string | + | |
| - | * Example (*.deeclass) <code xml>< | + | |
| - | ====== Events ====== | + | ===== touchSensor.set |
| - | ===== elementEntered ===== | + | Set one or more touch sensor parameters. |
| - | Element entered | + | ^Parameter^Value^Description^ |
| + | |collisionFilter.filter.set|string|Set named [[gamedev: | ||
| + | |collisionFilter.filter.clear|string|Clear named [[gamedev: | ||
| + | |enabled|'' | ||
| + | This is an example of using this action: | ||
| + | <code xml> | ||
| + | <action name=' | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| - | ===== elementLeft | + | ===== touchSensor.update |
| - | Element left touch sensor. | + | Update |
| - | ===== elementCanTouch ===== | + | ^Parameter^Value^Description^ |
| + | |touching.runEvent|string|Run state machine event on all touching elements supporting [[behavior_statemachine|ECBehaviorStateMachine]]| | ||
| - | Element can touch this touch sensor if all listeners return | + | This is an example of using this action: |
| + | <code xml> | ||
| + | <action name=' | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== touchSensor.check ===== | ||
| + | |||
| + | Check one or more touch sensor parameters. Action succeeds if all parameter value matches their respective touch sensor parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a touch sensor parameter matches (or not). | ||
| + | |||
| + | ^Parameter^Value^Description^ | ||
| + | |count|integer|Count of touching elements equals integer value| | ||
| + | |count.not|integer|Count of touching elements does not equal integer value| | ||
| + | |count.less|integer|Count of touching elements is less than integer value| | ||
| + | |count.greater|integer|Count of touching elements is greater than integer value| | ||
| + | |player|'' | ||
| + | |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> | ||
| + | < | ||
| + | <action name=' | ||
| + | < | ||
| + | </ | ||
| + | <!-- actions here run only if player is touching | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ====== Behavior Tree Conditions ====== | ||
| + | |||
| + | This behavior adds these behavior tree conditions if behavior tree is present. | ||
| + | |||
| + | ===== touchSensor.check ===== | ||
| + | |||
| + | Check one or more touch sensor parameters. Conditions returns true if all parameter value match their respective touch sensor parameter. This condition is typically used to run an action or sequence of actions as long as touch sensor conditions are true. | ||
| + | |||
| + | ^Parameter^Value^Description^ | ||
| + | |touchSensor.count|integer|Count of touching elements equals integer value| | ||
| + | |touchSensor.count.not|integer|Count of touching elements does not equal integer value| | ||
| + | |touchSensor.count.less|integer|Count of touching elements is less than integer value| | ||
| + | |touchSensor.count.greater|integer|Count of touching elements is greater than integer value| | ||
| + | |touchSensor.player|'' | ||
| + | |||
| + | This is an example of using this condition: | ||
| + | <code xml> | ||
| + | <action name=' | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ====== State Machine Actions ====== | ||
| + | |||
| + | Same as [[# | ||
| + | |||
| + | ====== State Machine Conditions ====== | ||
| + | |||
| + | Same as [[# | ||
| + | |||
| + | ====== State Machine Events ====== | ||
| + | |||
| + | This behavior sends these state machine events. If behavior has non-empty identifier replace '' | ||
| + | |||
| + | ===== touchSensor.entered ===== | ||
| + | |||
| + | Element entered touch sensor. Element is send as event parameter. Use [[behavior_statemachine# | ||
| + | |||
| + | ===== touchSensor.left ===== | ||
| + | |||
| + | Element left touch sensor. Element is send as event parameter. Use [[behavior_statemachine# | ||
| ====== Required Behaviors ====== | ====== Required Behaviors ====== | ||
| Line 107: | Line 213: | ||
| * [[behavior_collider|ECBehaviorCollider]]: | * [[behavior_collider|ECBehaviorCollider]]: | ||
| + | * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: | ||
| + | * [[behavior_statemachine|ECBehaviorStateMachine]]: | ||
| ====== Persistency ====== | ====== Persistency ====== | ||
| Line 149: | Line 257: | ||
| | | ||
| < | < | ||
| - | <!-- optional: | + | <!-- optional: |
| - | category BaseGameApp.CollisionFilterBit.trigger | + | <string name='behaviorTree'> |
| - | filter BaseGameApp.CollisionFilterBit.actorAI. | + | |
| - | | + | < |
| - | are a list of bits to set. --> | + | <string name='stateMachine'>second</ |
| - | <string name='collisionFilter'>3:4 0</ | + | |
| | | ||
| <!-- set element properties. omit property prefix if used inside behavior tag --> | <!-- set element properties. omit property prefix if used inside behavior tag --> | ||