简体   繁体   中英

How to get Daydream Controller to work in AFrame

I'm going crazy trying to get daydream controls to work in a my AFrame app. I'm not sure if it's my code, or my browser... Does anyone have an example that should work with the daydream controller?

This should be quite simple. Just use the official daydream component :

<a-entity daydream-controls="hand: left"></a-entity>
<a-entity daydream-controls="hand: right"></a-entity>

and utilize the emited events:

AFRAME.registerComponent("daydream-listener", {
 init: function() {
  this.el.addEventListener("trackpaddown", (e) => {
    console.log("track down: ");
    console.log(e);
  })
 }
})

<a-entity daydream-controls daydream-listener></a-entity>

live fiddle here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM