jeromeetienne / AR.js

Efficient Augmented Reality for the Web - 60fps on mobile!
MIT License
15.8k stars 2.22k forks source link

THREE is not defined #693

Closed EugeneFitzher closed 4 years ago

EugeneFitzher commented 4 years ago

aframe-ar.js:1669 Uncaught ReferenceError: THREE is not defined at aframe-ar.js:1669 aframe-ar.min.js:1 Uncaught ReferenceError: THREE is not defined at aframe-ar.min.js:1

Hello, I'm new to webAR, and I'm trying to learn it. I have upper errors when I use ar.js from my documents. But, when I use js from 'https://aframe.io/releases/1.0.0/aframe.min.js' and 'https://raw.githack.com/jeromeetienne/AR.js/2.1.4/aframe/build/aframe-ar.js' it works fine.

I just downloaded AR.js-master.zip from github, and unzipped.

my html is right inside of AR.js-master\ How can I solve this problem? Thanks.

kalwalt commented 4 years ago

Have you run a server (with python or node) ?

EugeneFitzher commented 4 years ago

Have you run a server (with python or node) ?

Yes(with node), but whether I run it on server or not, same error occured.

kalwalt commented 4 years ago

@EugeneFitzher ok, but this happens on the ar.js examples or in your modified code ? please give us more details on this issue.

EugeneFitzher commented 4 years ago

@EugeneFitzher ok, but this happens on the ar.js examples or in your modified code ? please give us more details on this issue.

On https://github.com/jeromeetienne/AR.js/blob/master/README.md#get-started , when I just change <script src="https://aframe.io/release/1.0.0/aframe.min.js"></script> <script src=https://raw.githack.com/jeromeetienne/AR.js/2.1.4/aframe/build/aframe-ar.js"></script> into local js file directory, the error occured. I have tried to change and move the files directory, nothing changed. But with https://~, it works fine.

nicolocarpignoli commented 4 years ago

you have to use https in order to use AR.js (accessing camera and other device sensors).

ghost commented 4 years ago

you replaced src="https://aframe.io/releases/1.0.0/aframe.min.js" with src="aframe/build/aframe-ar.min.js". but aframe-ar.min.js is different to aframe.min.js.

download aframe.min.js from aframe.io, replace with src="aframe.min.js", and should work.

(also see #569, #432)