A-Frame 仅显示存在的 vive 控件

A-Frame only show vive controls if they exist

有没有办法只显示来自 A-Frame 的 Vive 控制器(如果它们确实已连接)。但如果不是不显示控制器?

https://aframe.io/docs/master/components/vive-controls.html

如果找不到控制器,您可以编写一个组件来隐藏它们:

AFRAME.registerComponent('hide-if-no-controllers', {
  init: function () {
    if (this.sceneEl.systems['tracked-controls'].controllers.length) { return; }  // Alternatively, use navigator.getGamepads().
    this.setAttribute('visible', false);
  }
});