This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_vrhandpointedat [2024/03/14 16:57] – dragonlord | dragengine:modules:dragonscript:behavior_vrhandpointedat [2025/05/04 13:48] (current) – [vrHandPointedAt.check] dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 14: | Line 14: | ||
====== Instance Counts ====== | ====== Instance Counts ====== | ||
- | This behavior can be used only once on an element. The behavior always has identifier empty string. | + | |
+ | This behavior can be used only once on an element. | ||
====== Element Class Properties ====== | ====== Element Class Properties ====== | ||
- | Element class properties have the prefix | + | |
+ | Element class properties have the prefix | ||
This behavior defines no element class properties. | This behavior defines no element class properties. | ||
- | ====== | + | ====== |
- | This behavior does not required other behaviors to be present. | + | |
- | ====== | + | ===== handStartsPointingAt |
- | This behavior does not support optional behaviors. | + | |
- | ====== Persistency ====== | + | Hand starts pointing at element. |
- | This behavior does support | + | |
- | Saves the list of [[behavior_vrhandpointat|ECBehaviorVRHandPointAt]] pointing at the element. | + | ===== handStopsPointingAt ===== |
- | ====== Events ====== | + | Hand stops pointing at element. |
- | This behavior supports adding listeners. These events can be received: | + | |
- | ===== handStartsPointingAt | + | ====== Behavior Tree Actions ====== |
- | [[behavior_vrhandpointat|ECBehaviorVRHandPointAt]] starts pointing at object. Event contains [[behavior_vrhandpointat|ECBehaviorVRHandPointAt]] pointing at object. | + | |
- | ===== handStopsPointingAt ===== | + | This behavior adds these behavior tree actions if behavior tree is present. |
- | [[behavior_vrhandpointat|ECBehaviorVRHandPointAt]] stops pointing at object. Event contains [[behavior_vrhandpointat|ECBehaviorVRHandPointAt]] no more pointing at object. | + | |
+ | ===== vrHandPointedAt.check ===== | ||
+ | |||
+ | Check one or more vr hand pointed-at parameters. Action succeeds if all parameter value matches their respective vr hand pointed-at parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a vr hand pointed-at parameter matches (or not). | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |count|integer|Count of vr hands pointing at element equals integer value| | ||
+ | |count.not|integer|Count of vr hands pointing at element does not equal integer value| | ||
+ | |count.less|integer|Count of vr hands pointing at element is less than integer value| | ||
+ | |count.greater|integer|Count of vr hands pointing at element 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 pointing at element --> | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== Behavior Tree Conditions ====== | ||
+ | |||
+ | This behavior adds these behavior tree conditions if behavior tree is present. | ||
+ | |||
+ | ===== vrHandPointedAt.check ===== | ||
+ | |||
+ | Check one or more vr hand pointed-at parameters. Conditions returns true if all parameter value match their respective vr hand pointed-at parameter. This condition is typically used to run an action or sequence of actions as long as vr hand pointed-at conditions are true. | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |vrHandPointedAt.count|integer|Count of vr hands pointing at element equals integer value| | ||
+ | |vrHandPointedAt.count.not|integer|Count of vr hands pointing at element does not equal integer value| | ||
+ | |vrHandPointedAt.count.less|integer|Count of vr hands pointing at element is less than integer value| | ||
+ | |vrHandPointedAt.count.greater|integer|Count of vr hands pointing at element is greater than integer value| | ||
+ | |vrHandPointedAt.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 '' | ||
+ | |||
+ | ===== vrHandPointedAt.start ===== | ||
+ | |||
+ | Hand starts pointing at element. | ||
+ | |||
+ | ===== vrHandPointedAt.stop ===== | ||
+ | |||
+ | Hand stops pointing at element. | ||
+ | |||
+ | ====== Required Behaviors ====== | ||
+ | |||
+ | This behavior does not required other behaviors to be present. | ||
+ | |||
+ | ====== Optional Behaviors ====== | ||
+ | |||
+ | * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: | ||
+ | * [[behavior_statemachine|ECBehaviorStateMachine]]: | ||
+ | |||
+ | ====== Persistency ====== | ||
+ | |||
+ | This behavior does support element class to be persistable (setPersistable). | ||
====== API Documentation ====== | ====== API Documentation ====== | ||
+ | |||
# | # | ||
- | Since DragonScript Module Version | + | Since DragonScript Module Version |
====== Use Cases ====== | ====== Use Cases ====== | ||
+ | |||
* Show outline and interact prompts if player points at object. | * Show outline and interact prompts if player points at object. | ||
* For NPCs to react to player (or other actors) pointing at them (for example looking back at player). | * For NPCs to react to player (or other actors) pointing at them (for example looking back at player). | ||
Line 66: | Line 141: | ||
end | end | ||
</ | </ | ||
+ | |||
+ | ====== Behavior Factory ====== | ||
+ | |||
+ | Using element class supporting adding behaviors the behavior can be added like this: | ||
+ | <code xml> | ||
+ | <?xml version=' | ||
+ | < | ||
+ | < | ||
+ | <!-- 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 --> | ||
+ | <string name=' | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== Live Examples ====== | ||
+ | |||
+ | * [[https:// | ||
+ |