Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorRenderableCustomColor
Behavior in action
Behavior element behavior adding VR Hand Controller support to actor. This behavior tracks one hand controller optionally displaying it on screen using either the developer provided model or a custom model. Optionally a rig can be assigned to get physical presence of the controller in the game world.
This behavior can be added twice to an element to add support for left and right hand controller. Use the behavior identifier to tell them apart.
Element class properties have the prefix vrHand.
or vrHand(id).
if id is not empty.
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.
vrHand.useVendorModel
or vrHand(id).useVendorModel
true
<boolean name='vrHand(right).useVendorModel'>false</boolean>
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.
vrHand.showHand
or vrHand(id).showHand
true
<boolean name='vrHand(left).showHand'>false</boolean>
This behavior adds a child 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
.
Hand controller attached and ready to use.
Hand controller detached and no more usable.
This behavior does not support optional behaviors.
This behavior does not use persistency.
Since DragonScript Module Version 1.6
The following example creates an element class with two hand controllers.
class MyElement extends BehaviorElementClass func new() // Add VR Playspace behavior. Base behavior required by all VR behaviors var ECBehaviorVRPlayspace vrPlayspace = ECBehaviorVRPlayspace.new(this) // Add VR HMD behavior. With this behavior present VRPlayerControlledActorCameraDirector // can attach the HMD to the in-game camera ECBehaviorVRHMD.new(this, vrPlayspace) // Add left and right hand controller. The InputDeviceType is required // for the behavior to know which input device to monitor ECBehaviorVRHand.new(this, vrPlayspace, InputDeviceType.vrRightHand, "right") ECBehaviorVRHand.new(this, vrPlayspace, InputDeviceType.vrLeftHand, "left") end end
Using element class supporting adding behaviors the behavior can be added like this:
<?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> <!-- set element properties. omit property prefix if used inside behavior tag --> <boolean name='.useVendorModel'>true</boolean> </behavior> <behavior type='ECBehaviorVRHand' id='left'> ... </behavior> </elementClass>