User Tools

Site Tools


dragengine:modules:dragonscript:behavior_vrcontroldesktop

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_vrcontroldesktop [2025/05/13 23:03] dragonlorddragengine:modules:dragonscript:behavior_vrcontroldesktop [2025/05/14 01:12] (current) dragonlord
Line 27: Line 27:
 ====== Behavior Tree Actions ====== ====== Behavior Tree Actions ======
  
-This behavior adds these behavior tree actions if behavior tree is present.+This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace ''vrControlDesktop'' with ''vrControlDesktop(id)''.
  
-===== vrhmd.check =====+===== vrControlDesktop.set =====
  
-Check one or more VR HMD parameters. Action succeeds if all parameter value matches their respective VR HMD parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a VR HMD parameter matches (or not).+Set one or more control desktop parameters.
  
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
-|attached|''true'', ''false''|VR HMD is attached and usable|+|interact|string|Interact with desktop. If element is absent action fails. Runs interaction with name value. If interaction with name value is absent fails action. If interaction returns false fails action. Otherwise action succeeds.| 
 +|interact.parameters|string|Optional parameters to use with ''interaction''.| 
 +|interactElement.assign|string|Assign desktop to [[behavior_interactelement|ECBehaviorInteractElement]] with identifier matching value string. Action fails if no element is looked at or interact element behavior is absent| 
 + 
 +This is an example of using this action: 
 +<code xml> 
 +<action name='vrControlDesktop.set'> 
 +  <parameter name='interactElement.assign'/> 
 +</action> 
 +</code> 
 + 
 +===== vrControlDesktop.check ===== 
 + 
 +Check one or more control desktop parameters. Action succeeds if all parameter value matches their respective control desktop parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a control desktop parameter matches (or not). 
 + 
 +^Parameter^Value^Description^ 
 +|desktop|''true'', ''false''|Desktop is controlled| 
 +|interact.name|string|Name of interaction| 
 +|interact.has|''true'', ''false''|Has desktop and interaction with name ''interaction.name'' is present| 
 +|interact.query|''true'', ''false''|Interact with desktop and test result. Condition is true if desktop is present, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).| 
 +|interact.parameters|string|Optional parameters to use with ''interaction.query''.|
 |wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled| |wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled|
  
Line 40: Line 60:
 <code xml> <code xml>
 <sequence> <sequence>
-  <action name='vrhmd.check'> +  <action name='vrControlDesktop.check'> 
-    <parameter name='attached>true</parameter>+    <parameter name='desktop'>true</parameter>
   </action>   </action>
-  <!-- actions here run only if VR HMD is attached and usable -->+  <!-- actions here run only if player is controlling a desktop -->
 </sequence> </sequence>
 </code> </code>
Line 49: Line 69:
 ====== Behavior Tree Conditions ====== ====== Behavior Tree Conditions ======
  
-This behavior adds these behavior tree conditions if behavior tree is present.+This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace ''vrControlDesktop'' with ''vrControlDesktop(id)''.
  
-===== vrhmd.check =====+===== vrControlDesktop.check =====
  
-Check one or more VR HMD parameters. Conditions returns true if all parameter value match their respective VR HMD parameter. This condition is typically used to run an action or sequence of actions as long as VR HMD conditions are true.+Check one or more control desktop parameters. Conditions returns true if all parameter value match their respective control desktop parameter. This condition is typically used to run an action or sequence of actions as long as control desktop conditions are true.
  
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
-|vrhmd.attached|''true'', ''false''|VR HMD is attached and usable|+|desktop|''true'', ''false''|Desktop is controlled| 
 +|vrControlDesktop.interact.name|string|Name of interaction| 
 +|vrControlDesktop.interact.has|''true'', ''false''|Has desktop and interaction with name ''interaction.name'' is present| 
 +|vrControlDesktop.interact.query|''true'', ''false''|Interact with desktop and test result. Condition is true if desktop is present, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).| 
 +|vrControlDesktop.interact.parameters|string|Optional parameters to use with ''interaction.query''.|
  
 This is an example of using this condition: This is an example of using this condition:
 <code xml> <code xml>
 <action name='myAction' id='doing something'> <action name='myAction' id='doing something'>
-  <parameter name='vrhmd.attached'>true</parameter> +  <parameter name='vrControlDesktop.enabled'>true</parameter> 
-  <condition>vrhmd.check</condition>+  <condition>vrControlDesktop.check</condition>
 </action> </action>
 </code> </code>
Line 214: Line 238:
 <?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
 <elementClass name='MyClass' class='GenericBehaviorElement'> <elementClass name='MyClass' class='GenericBehaviorElement'>
-  <behavior type='ECBehaviorVRHMD'> +  <behavior type='ECBehaviorVRPlayspace'/> 
-    <!-- optional: use BaseGameApp binding manager. game can add more supported values --> +  <behavior type='ECBehaviorVRHand' id='right'/> 
-    <string name='bindingManager'>default</string>+  <behavior type='ECBehaviorVRHand' id='left'/> 
 +  <behavior type='ECBehaviorVRHandPointAt' id='right'> 
 +    <string name='vrHand'>right</string> 
 +  </behavior> 
 +  <behavior type='ECBehaviorVRHandPointAt' id='left'> 
 +    <string name='vrHand'>left</string> 
 +  </behavior> 
 +   
 +  <behavior type='ECBehaviorVRControlDesktop' id='right'> 
 +    <!-- required: use vr hand point at with id --> 
 +    <string name='vrHandPointAt'>right</string>
          
     <!-- optional: add behavior trees. default adds all behavior trees. -->     <!-- optional: add behavior trees. default adds all behavior trees. -->
Line 229: Line 263:
       <string>default</string> <!-- add behavior with 'default' identifier -->       <string>default</string> <!-- add behavior with 'default' identifier -->
     </list>     </list>
 +    
 +    <!-- set element properties. omit property prefix if used inside behavior tag -->
 +    <string name='.name'>value</string>
 +  </behavior>
 +  
 +  <behavior type='ECBehaviorVRControlDesktop' id='left'>
 +    <string name='vrHandPointAt'>left</string>
   </behavior>   </behavior>
 </elementClass> </elementClass>
dragengine/modules/dragonscript/behavior_vrcontroldesktop.1747177401.txt.gz · Last modified: 2025/05/13 23:03 by dragonlord