Aframe, Can not get a reference to the cameras THREE.js object3D

时间:2018-02-22 04:30:49

标签: three.js aframe

AFRAME.registerComponent('temp', {

      init: function () {

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

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

    });

I have an aframe scene with just a box and an a-camera object. I am trying to get a reference to the camera's object3D however, whenever I try, I am getting an undefined object. In addition to above, I have tried doing document.querySelector("#camera").object3D and that does not work either.

1 个答案:

答案 0 :(得分:2)

您正试图在其中一个A-Frame示例(https://aframe.io/aframe/examples/boilerplate/hello-world/)上完成此任务:

handleClickLogo = () => { this.props.children.props.history.push('/'); };

example