This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_touchsensor [2025/03/13 16:48] – created dragonlord | dragengine:modules:dragonscript:behavior_touchsensor [2025/05/04 13:50] (current) – [touchSensor.check] dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 90: | Line 90: | ||
Element entered touch sensor. | Element entered touch sensor. | ||
- | |||
===== elementLeft ===== | ===== elementLeft ===== | ||
Line 99: | Line 98: | ||
Element can touch this touch sensor if all listeners return true. | Element can touch this touch sensor if all listeners return true. | ||
+ | |||
+ | ====== Behavior Tree Actions ====== | ||
+ | |||
+ | This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace '' | ||
+ | |||
+ | ===== touchSensor.set ===== | ||
+ | |||
+ | Set one or more touch sensor parameters. | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |enabled|'' | ||
+ | |||
+ | 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 touch sensor --> | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== 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. | ||
+ | |||
+ | ===== touchSensor.left ===== | ||
+ | |||
+ | Element left touch sensor. | ||
====== Required Behaviors ====== | ====== Required Behaviors ====== | ||
Line 107: | Line 189: | ||
* [[behavior_collider|ECBehaviorCollider]]: | * [[behavior_collider|ECBehaviorCollider]]: | ||
+ | * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: | ||
+ | * [[behavior_statemachine|ECBehaviorStateMachine]]: | ||
====== Persistency ====== | ====== Persistency ====== | ||
Line 149: | Line 233: | ||
| | ||
< | < | ||
+ | <!-- optional: set collision filter. default value ' | ||
+ | | ||
+ | | ||
+ | | ||
+ | are a list of bits to set. --> | ||
+ | <string name=' | ||
+ | | ||
+ | <!-- optional: use behavior tree with id instead of empty string --> | ||
+ | <string name=' | ||
+ | | ||
+ | <!-- optional: use state machine with id instead of empty string --> | ||
+ | <string name=' | ||
+ | | ||
<!-- set element properties. omit property prefix if used inside behavior tag --> | <!-- set element properties. omit property prefix if used inside behavior tag --> | ||
<boolean name=' | <boolean name=' |