0

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

H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
Alex Coulombe
  • 87
  • 1
  • 7
  • This question is not about A-Frame; it's a general JavaScript question which has already been answered here: http://stackoverflow.com/questions/25962958/calling-a-javascript-function-in-another-js-file – thoragio Mar 29 '17 at 15:20
  • sorry, I should have been more specific since I tried that and it didn't work. I thought aframe might have something else going on that doesn't allow this to work the same way. – Alex Coulombe Mar 29 '17 at 16:48
  • Have you tried calling the function with its A-Frame reference? `AFRAME.utils.device.checkHasPositionalTracking ()` – thoragio Mar 30 '17 at 20:24
  • ah! thank you. Yes that seems to resolve the error, though it seems like AFRAME.utils.device.checkHasPositionalTracking(false); is not enough to stop Aframe from using positional tracking. But that's a different question! (http://stackoverflow.com/questions/43084550/aframe-can-positional-tracking-be-turned-off) Thank you and if you post that as an answer I'll mark it correct. – Alex Coulombe Mar 31 '17 at 21:02

1 Answers1

0

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.

thoragio
  • 289
  • 1
  • 10