Aframe,无法获取对相机THREE.js object3D的引用

0 three.js aframe

AFRAME.registerComponent('temp', {

      init: function () {

        var el = this.el;
        var camera = this.el.getObject3D('camera');

        console.log("CAMERA: "+camera);
      }

    });
Run Code Online (Sandbox Code Playgroud)

我有一个只有一个盒子和一个相机对象的框架场景。我试图获取对相机 object3D 的引用,但是,每当我尝试时,我都会得到一个未定义的对象。除了上述之外,我还尝试过执行 document.querySelector("#camera").object3D ,但这也不起作用。

Die*_*cos 5

这就是您试图在 A 框架示例之一 ( https://aframe.io/aframe/examples/boilerplate/hello-world/ ) 上实现的目标:

document.querySelector("[camera]").getObject3D('camera')

例子