Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorVRHandPointedAt
Behavior element behavior adding support to track if VR hands point at element.
This behavior tracks if hand controllers are pointing at the element. If hand controllers start pointing at the element they are added to the list and listeners are notified. If the hand controllers stop pointing at the element they are removed from the list and listeners are notified. The behavior itself is passive. It requires to be triggered by the hand controllers elements. The ECBehaviorVRHandPointAt behavior provides this functionality.
This behavior can be used only once on an element.
Element class properties have the prefix vrHandPointedAt.
.
This behavior defines no element class properties.
Hand starts pointing at element.
Hand stops pointing at element.
This behavior does not required other behaviors to be present.
This behavior does not support optional behaviors.
This behavior does support element class to be persistable (setPersistable).
Since DragonScript Module Version 1.7
class ExampleElementClass extends BehaviorElementClass public var ECBehaviorVRHandPointedAt vrHandPointedAt public func new() super("ExampleElement") // Add pointed at behavior. By itself this does nothing yet. Add listeners to the // behavior to react to pointing-at changes. This is typically done by other // behaviors to provide their functionality vrHandPointedAt = ECBehaviorVRHandPointedAt.new(this) 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='ECBehaviorVRHandPointedAt'> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.name'>value</string> </behavior> </elementClass>