User Tools

Site Tools


dragengine:modules:dragonscript:behavior_vrhand

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_vrhand [2024/03/14 16:57] dragonlorddragengine:modules:dragonscript:behavior_vrhand [2025/05/14 10:34] (current) 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]] >> **ECBehaviorRenderableCustomColor**+[[: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]] >> **ECBehaviorRenderableCustomColor**
 </WRAP> </WRAP>
  
Line 24: Line 24:
 ====== Element Class Properties ====== ====== Element Class Properties ======
  
-Element class properties have the prefix **vrHand.** or **vrHand(id).** if id is not empty.+Element class properties have the prefix ''vrHand.'' or ''vrHand(id).'' if id is not empty.
  
 ===== useVendorModel ===== ===== useVendorModel =====
-Determines if the Vendor Specific 3D Model is used to show the device. The Vendor Specific 3D Model is provided by the VR Runtime installation. If set to false **vrHand(id).component.* ** properties can be used to define the model to use. +Determines if the Vendor Specific 3D Model is used to show the device. The Vendor Specific 3D Model is provided by the VR Runtime installation. If set to false ''vrHand(id).component.*'' properties can be used to define the model to use. 
-  * Full name: "vrHand.useVendorModelor "vrHand(id).useVendorModel"+  * Full name: ''vrHand.useVendorModel'' or ''vrHand(id).useVendorModel''
   * Type: boolean   * Type: boolean
-  * Default Value: true+  * Default Value: ''true''
   * Example (*.deeclass): <code xml><boolean name='vrHand(right).useVendorModel'>false</boolean></code>   * Example (*.deeclass): <code xml><boolean name='vrHand(right).useVendorModel'>false</boolean></code>
  
 ===== showHand ===== ===== showHand =====
 Determines if the device is shown in the 3D view. Set this to true if you use a separate model to show the hands. Set to false if you use the regular animated actor support to animate the hands using the hand position and orientation as input. Determines if the device is shown in the 3D view. Set this to true if you use a separate model to show the hands. Set to false if you use the regular animated actor support to animate the hands using the hand position and orientation as input.
-  * Full name: "vrHand.showHandor "vrHand(id).showHand"+  * Full name: ''vrHand.showHand'' or ''vrHand(id).showHand''
   * Type: boolean   * Type: boolean
-  * Default value: true+  * Default value: ''true''
   * Example (*.deeclass): <code xml><boolean name='vrHand(left).showHand'>false</boolean></code>   * Example (*.deeclass): <code xml><boolean name='vrHand(left).showHand'>false</boolean></code>
  
 ===== component.* ===== ===== component.* =====
-This behavior adds a child [[behavior_component|ECBehaviorComponent]] to the element class to show the hand in the game world. The child behavior has the identifier "vrHand" or "vrHand(id)". The child behavior has the element class property prefix "vrHand.component." or "vrHand(id).component.". 
  
-Hence to set for example the component model of the right hand use the element class property "vrHand(right).component.model"+This behavior adds a child [[behavior_component|ECBehaviorComponent]] to the element class to show the hand in the game world. The child behavior has the identifier ''vrHand'' or ''vrHand(id)''. The child behavior has the element class property prefix ''vrHand.component.'' or ''vrHand(id).component.''
 + 
 +Hence to set for example the component model of the right hand use the element class property ''vrHand(right).component.model''
 + 
 +====== Events ====== 
 + 
 +===== controllerAttached ===== 
 + 
 +Hand controller attached and ready to use. 
 + 
 +===== controllerDetached ===== 
 + 
 +Hand controller detached and no more usable. 
 + 
 +====== Behavior Tree Actions ====== 
 + 
 +This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace ''vrHand'' with ''vrHand(id)''
 + 
 +===== vrHand.check ===== 
 + 
 +Check one or more VR hand parameters. Action succeeds if all parameter value matches their respective VR hand parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a VR hand parameter matches (or not). 
 + 
 +^Parameter^Value^Description^ 
 +|attached|''true'', ''false''|VR controller is attached| 
 +|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='vrHand.check'> 
 +    <parameter name='attached'>true</parameter> 
 +  </action> 
 +  <!-- actions here run only if VR hand controller is attached --> 
 +</sequence> 
 +</code> 
 + 
 +====== Behavior Tree Conditions ====== 
 + 
 +This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace ''vrHand'' with ''vrHand(id)''
 + 
 +===== vrHand.check ===== 
 + 
 +Check one or more VR hand parameters. Conditions returns true if all parameter value match their respective VR hand parameter. This condition is typically used to run an action or sequence of actions as long as VR hand conditions are true. 
 + 
 +^Parameter^Value^Description^ 
 +|vrHand.attached|''true'', ''false''|VR controller is attached| 
 + 
 +This is an example of using this condition: 
 +<code xml> 
 +<action name='myAction' id='doing something'> 
 +  <parameter name='vrHand.attached'>true</parameter> 
 +  <condition>vrHand.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 ''vrHand'' with ''vrHand(id)''
 + 
 +===== vrHand.attached ===== 
 + 
 +VR controller has been attached. 
 + 
 +===== vrHand.disabled ===== 
 + 
 +VR controller has been detached.
  
 ====== Required Behaviors ====== ====== Required Behaviors ======
Line 51: Line 123:
 ====== Optional Behaviors ====== ====== Optional Behaviors ======
  
-This behavior does not support 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 ====== ====== Persistency ======
Line 61: Line 134:
 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorVRHand.html,ECBehaviorVRHand~@#. #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorVRHand.html,ECBehaviorVRHand~@#.
  
-Since DragonScript Module Version **1.6**+Since DragonScript Module Version ''1.6''
  
 ====== Use Cases ====== ====== Use Cases ======
Line 73: Line 146:
 <code> <code>
 class MyElement extends BehaviorElementClass class MyElement extends BehaviorElementClass
-  public func new()+  func new()
     // Add VR Playspace behavior. Base behavior required by all VR behaviors     // Add VR Playspace behavior. Base behavior required by all VR behaviors
     var ECBehaviorVRPlayspace vrPlayspace = ECBehaviorVRPlayspace.new(this)     var ECBehaviorVRPlayspace vrPlayspace = ECBehaviorVRPlayspace.new(this)
Line 87: Line 160:
   end   end
 end end
 +</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='ECBehaviorVRPlayspace'/>
 +  <behavior type='ECBehaviorVRHMD'/>
 +  
 +  <behavior type='ECBehaviorVRHand' id='right'>
 +    <!-- required: use BaseGameApp input device type. Constant of InputDeviceType.
 +                   use either 'vrRightHand' or 'vrLeftHand'. -->
 +    <string name='inputDeviceType'>vrRightHand</string>
 +    
 +    <!-- optional: use BaseGameApp binding manager. game can add more supported values.
 +                   default is 'default' -->
 +    <string name='bindingManager'>default</string>
 +    
 +    <!-- optional: set collision filter. default value '' which means empty category
 +                   and full filter. format is '', 'category' or 'category:filter'
 +                   where category and filter are a list of bits to set. -->
 +    <string name='collisionFilter'>6:0 1 2 3 5</string>
 +    
 +    <!-- optional: add behavior trees. default adds all behavior trees. -->
 +    <list name='behaviorTrees'>
 +      <string/> <!-- add behavior with empty identifier -->
 +      <string>default</string> <!-- add behavior with 'default' identifier -->
 +    </list>
 +    
 +    <!-- optional: add state machines. default adds all state machines. -->
 +    <list name='stateMachines'>
 +      <string/> <!-- add behavior with empty identifier -->
 +      <string>default</string> <!-- add behavior with 'default' identifier -->
 +    </list>
 +    
 +    <!-- set element properties. omit property prefix if used inside behavior tag -->
 +    <boolean name='.useVendorModel'>true</boolean>
 +  </behavior>
 +  
 +  <behavior type='ECBehaviorVRHand' id='left'>
 +    ...
 +  </behavior>
 +</elementClass>
 </code> </code>
  
dragengine/modules/dragonscript/behavior_vrhand.1710435426.txt.gz · Last modified: 2024/03/14 16:57 by dragonlord