Reputation: 5
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.
Upvotes: 0
Views: 1483
Reputation: 4585
This is what you are trying to accomplish on one of the A-Frame examples (https://aframe.io/aframe/examples/boilerplate/hello-world/):
document.querySelector("[camera]").getObject3D('camera')
Upvotes: 5