Search code examples
javascriptaframewebvr

A-frame, controlling 'hand-controls' with keyboard/mouse


Is this possible?

Since my understanding of aframe and how entity-component system works is severely lacking, i simply tried to call one of the hand methods in the hand-controls component.

// I want to see a grip event 
handControllerDOMElementReference.components['hand-controls'].onGripDown()

This achieved nothing. When tracing everything that happens in the 'hand-controls' component it looks like the gestures and animations are all called. But nothing happens, so i'm assuming i'm doing this completely the wrong way.

What is the right approach?


Solution

  • Currently, hand-controls responds to events that some component like oculus-touch-controls or vive-controls emit, see https://github.com/aframevr/aframe/blob/master/src/components/hand-controls.js#L57

    It is certainly possible to have other components provide those events, such as https://github.com/chenzlabs/gearvr-controls or ryanbetts aframe-daydream-controller-component

    Perhaps you can either manually generate those events, or better yet create a component that generates them when applied?