{{tag>dragonscript behavior}} [[: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** * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] ====== 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 [[behavior_vrhandpointat|ECBehaviorVRHandPointAt]] behavior provides this functionality. ====== Instance Counts ====== This behavior can be used only once on an element. ====== Element Class Properties ====== Element class properties have the prefix ''vrHandPointedAt.'' . This behavior defines no element class properties. ====== Events ====== ===== handStartsPointingAt ===== Hand starts pointing at element. ===== handStopsPointingAt ===== Hand stops pointing at element. ====== Required Behaviors ====== This behavior does not required other behaviors to be present. ====== Optional Behaviors ====== This behavior does not support optional behaviors. ====== Persistency ====== This behavior does support element class to be persistable (setPersistable). ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorVRHandPointedAt.html,ECBehaviorVRHandPointedAt~@#. Since DragonScript Module Version ''1.7'' ====== Use Cases ====== * 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). * Show target information if player aims at objects. ====== Element Class Example ====== 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 ====== Behavior Factory ====== Using element class supporting adding behaviors the behavior can be added like this: value ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]