Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THREE.math is renamed to THREE.mathUtils and breaks location based logic #822

Open
JvJefke opened this issue Mar 4, 2023 · 4 comments
Open

Comments

@JvJefke
Copy link

JvJefke commented Mar 4, 2023

Describe the bug
ar-threex-location-only.js throws an error when using new THREEx.LocationBased(...).

Uncaught TypeError: Cannot read properties of undefined (reading 'degToRad')
    at t._haversineDist (ar-threex-location-only.js:1:3186)
    at t._gpsReceived (ar-threex-location-only.js:1:2848)
    at ar-threex-location-only.js:1:1902

This happens because three.js has renamed the object THREE.math to THREE.mathUtils.
(changelog: https://github.com/mrdoob/three.js/releases/tag/r113)

I suggest updating the logic so it works with the latest three.js version. However this may break existing usages that make use of the older three.js version. I suggest putting a clear disclaimer or making the code backwards compatible.
(ar.js logic that uses Math: https://github.com/AR-js-org/AR.js/blame/8662537d2dc1701afc4eadfbf7b04db3341199de/three.js/src/location-based/js/location-based.js#L161)

To Reproduce
Steps to reproduce the behavior:

  1. use three.js version 0.113.0 or higher
  2. call const arjs = new THREEx.LocationBased(scene, camera);

Expected behavior
The code does not throw an error

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS Ventura
  • Browser Chrome

Smartphone (please complete the following information):

  • Device: Google Pixel 6
  • OS: Android
  • Browser Chrome
@tranhogdiep
Copy link

I same issues, I downgrade to r0.146.0 for the same with the repo but still happens. @JvJefke do you know if the revision of ThreeJs will work?

@DougReeder
Copy link

Likewise, this breaks with version 1.4.x of A-Frame, which uses a recent version of three.js

@JvJefke
Copy link
Author

JvJefke commented Mar 10, 2023

@tranhogdiep
I downgraded three.js to 0.112.0 and that seemed to "fix" it for now.

@DougReeder
Copy link

AR-js-org/AR.js#523 would fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants