【问题标题】:How to access the scene from within a component in A-Frame?如何从 A-Frame 的组件中访问场景?
【发布时间】:2017-01-14 12:58:17
【问题描述】:

如何从 A-Frame 中的组件.init() 函数中获取场景?

AFRAME.registerComponent('foo', {
  init: function () {
    // ?
  }
});

【问题讨论】:

    标签: aframe


    【解决方案1】:

    https://aframe.io/docs/0.4.0/core/component.html#component-prototype-properties

    AFRAME.registerComponent('foo', {
      init: function () {
        console.log(this.el.sceneEl);
      },
    
      update: function () {
        console.log(this.el.sceneEl);
      }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-08
      • 1970-01-01
      • 1970-01-01
      • 2017-12-29
      • 2017-02-21
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多