nicolocarpignoli / location-based-ar-tutorial

A Location Based AR Tutorial using AR.js v2
MIT License
76 stars 133 forks source link

Model stay on top of phone all the time #1

Open jamess922 opened 4 years ago

jamess922 commented 4 years ago

Hi: Just have quick try with static-on-html,but the model always on top of my phones no matter how far i am moving, what i changed just use all local files `

<script src="js/aframe-extras.loaders.min.js"></script>
<script>
    THREEx.ArToolkitContext.baseURL = <three.js/>
</script>`

phones: Huawei mate 20 pro Android 9 Iphone 7 IOS 12.4.1

nicolocarpignoli commented 4 years ago

hi please provide me your full index.html code, thx

jamess922 commented 4 years ago

Don't know how to show the full code in right way, so i update a iamge 360截图170701146611363 `<!DOCTYPE html>

GeoAR.js demo `
nicolocarpignoli commented 4 years ago

code looks ok. I need to see your chrome dev tools console, otherwise it's impossible to guess the problem

jamess922 commented 4 years ago

360截图17920827597544 looks the problem is about the CORS

jamess922 commented 4 years ago

Also did a quick test of static-places demo have same problem ,the location of the model has always been relative to the phone,not following the gps ,no matter how far i am moving. i am just add my gps position and use local js file and three.js folder function staticLoadPlaces() { return [ { name: 'Pokèmon', location: { lat: 28.9871737, lng: 128.7180368, }, }, ]; } `

<script src="js/aframe-extras.loaders.min.js"></script>
<script>
       THREEx.ArToolkitContext.baseURL = <three.js/>
</script>`

1 2 this time no more CORS

nicolocarpignoli commented 4 years ago

It's not cors in both cases. Cors errors may be there but are not blocking. You have a syntax error on HTML, look to the last screenshot. You have to fix that that's probably the error causing your problem

nicolocarpignoli commented 4 years ago

Also try with Chrome or safari

jamess922 commented 4 years ago

360截图17001017496373 this is the syntax error for what i have tested,looks the GPS not working no matter how long i am moving ,the size of model still same 01 02 03

nicolocarpignoli commented 4 years ago

@jamess922 Please, fill every request with:

It's hard and very time consuming to help without those information in every comment. This because you are changing code and testing several examples. Please provide those otherwise I can't help

jamess922 commented 4 years ago

Sorry for the later phones: Device:Huawei mate 20 pro Android 9 Drowser version:Chrome77.0.3865.92 Example :Static-places Full code:I marked the places i modified 360截图16321231192745 360截图167204041009299

jamess922 commented 4 years ago

and i have not made any changes to these JS files(aframeV2.js and aframe-arV2.js)

jamess922 commented 4 years ago

V2 only means they are from AR.js v2.0

nicolocarpignoli commented 4 years ago

code seems ok to me. Do you have accepted all geolocation permission of the browser?

jamess922 commented 4 years ago

I already accept all geolocation permission, and i tried with webpage map also the geolocation has problem,so i think the problem is the H5 Grolocation now i am going to try dynamic-places demo,and i find you are using foursquare,if that possible to use other one ,if it's ok how to change that to new one ,just replace?

jamess922 commented 4 years ago

and also want to know which browser you are using to test in that three demo

dirkk0 commented 4 years ago

You can get rid of the CORS messages if you download the aframe-ar.min.js and camera_para.dat and edit both occurences of camera_para.dat in the .js file.

The problem with the models always being to near seems to be a geolocation resolution problem. I had to edit my long and lat coordinates to a point over a hundred meters away to see any effect.

nicolocarpignoli commented 4 years ago

Working browser are safari for iphones and chrome for android. Firefox calculastes geolocation differently from chrome, I honestly don't know if works good as chrome.

You can use any other provider other than Foursquare. Anyway, if you have problems with geolocation itself APIs are not the issue.

You should check settings from your phone and try to reset cache/history from your browser. And try again.

doctorpants commented 4 years ago

Hey! Love the tutorial! I am having the same problems as James 922. iPhone 11, Safari Browser. Everything is right on top of me.