Aframe - call aframe function from another javascript file

久未见 提交于 2019-12-12 06:50:12

问题


I'm trying to turn positional tracking off, and I believe that this function in the aframe code is what I'm after:

checkHasPositionalTracking();

However, in my second js file (which is defined AFTER aframe.js), if I try to call that function, I receive this error:

Uncaught ReferenceError: checkHasPositionalTracking is not defined


回答1:


You need to call it with full reference to the window.AFRAME browser global, so use AFRAME.utils.device.checkHasPositionalTracking () in your code to access it.



来源:https://stackoverflow.com/questions/43083888/aframe-call-aframe-function-from-another-javascript-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!