User Tools

Site Tools


dragengine:modules:dragonscript:behavior_vrhandpointedat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dragengine:modules:dragonscript:behavior_vrhandpointedat [2021/11/04 19:24] – created dragonlorddragengine:modules:dragonscript:behavior_vrhandpointedat [2025/05/04 13:48] (current) – [vrHandPointedAt.check] dragonlord
Line 1: Line 1:
 {{tag>dragonscript behavior}} {{tag>dragonscript behavior}}
 <WRAP youarehere> <WRAP youarehere>
-[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorVRHandPointedAt**+[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorVRHandPointedAt**
 </WRAP> </WRAP>
  
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 **vrHandPointedAt.**.+ 
 +Element class properties have the prefix ''vrHandPointedAt.'' .
  
 This behavior defines no element class properties. This behavior defines no element class properties.
  
-====== Required Behaviors ====== +====== Events ======
-This behavior does not required other behaviors to be present.+
  
-====== Optional Behaviors ====== +===== handStartsPointingAt =====
-This behavior does not support optional behaviors.+
  
-====== Persistency ====== +Hand starts pointing at element.
-This behavior does support element class to be persistable (setPersistable).+
  
-Saves the list of [[behavior_vrhandpointat|ECBehaviorVRHandPointAt]] pointing at the element.+===== handStopsPointingAt =====
  
-====== Events ====== +Hand stops pointing at element.
-This behavior supports adding listenersThese 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|''true'', ''false''|Player is pointing at element|
 +|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>
 +<sequence>
 +  <action name='vrHandPointedAt.check'>
 +    <parameter name='player'>true</parameter>
 +  </action>
 +  <!-- actions here run only if player is pointing at element -->
 +</sequence>
 +</code>
 +
 +====== 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|''true'', ''false''|Player is pointing at element|
 +
 +This is an example of using this condition:
 +<code xml>
 +<action name='myAction' id='doing something'>
 +  <parameter name='vrHandPointedAt.player'>true</parameter>
 +  <condition>vrHandPointedAt.check</condition>
 +</action>
 +</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 ''occupier'' with ''occupier(id)''.
 +
 +===== 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]]: 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 ======
 +
 +This behavior does support element class to be persistable (setPersistable).
  
 ====== API Documentation ====== ====== API Documentation ======
-[[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Scenery_1_1ECBehaviorVRHandPointedAt.html|ECBehaviorVRHandPointedAt]]. 
  
-Since DragonScript Module Version **1.7**+#@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorVRHandPointedAt.html,ECBehaviorVRHandPointedAt~@#
 + 
 +Since DragonScript Module Version ''1.7''
  
 ====== 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
 </code> </code>
 +
 +====== Behavior Factory ======
 +
 +Using element class supporting adding behaviors the behavior can be added like this:
 +<code xml>
 +<?xml version='1.0' encoding='UTF-8'?>
 +<elementClass name='MyClass' class='GenericBehaviorElement'>
 +  <behavior type='ECBehaviorVRHandPointedAt'>
 +    <!-- optional: use behavior tree with id instead of empty string -->
 +    <string name='behaviorTree'>second</string>
 +    
 +    <!-- optional: use state machine with id instead of empty string -->
 +    <string name='stateMachine'>second</string>
 +    
 +    <!-- set element properties. omit property prefix if used inside behavior tag -->
 +    <string name='.name'>value</string>
 +  </behavior>
 +</elementClass>
 +</code>
 +
 +====== Live Examples ======
 +
 +  * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]
 +
dragengine/modules/dragonscript/behavior_vrhandpointedat.1636053888.txt.gz · Last modified: 2021/11/04 19:24 by dragonlord