如何从组件访问默认相机?
How to access the default camera from a component?
我正在制作的组件需要默认相机,但是 this.el.sceneEl.camera
returns undefined
。
AFRAME.registerComponent('test', {
init: function () {
console.log(this.el.sceneEl.camera)
}
});
如何找回相机?
可能需要等待相机设置好?需要对此进行记录,但有一个事件:
this.el.sceneEl.addEventListener('camera-set-active', function (evt) {
console.log(evt.detail.cameraEl);
});
我正在制作的组件需要默认相机,但是 this.el.sceneEl.camera
returns undefined
。
AFRAME.registerComponent('test', {
init: function () {
console.log(this.el.sceneEl.camera)
}
});
如何找回相机?
可能需要等待相机设置好?需要对此进行记录,但有一个事件:
this.el.sceneEl.addEventListener('camera-set-active', function (evt) {
console.log(evt.detail.cameraEl);
});