馃柤 Image Tracking Example
< script src ="https://cdn.jsdelivr.net/gh/aframevr/aframe@1.6.0/dist/aframe-master.min.js "> </ script >
< script src ="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar-nft.js "> </ script >
< style >
.arjs-loader {
height : 100% ;
width : 100% ;
position : absolute;
top : 0 ;
left : 0 ;
background-color : rgba (0 , 0 , 0 , 0.8 );
z-index : 9999 ;
display : flex;
justify-content : center;
align-items : center;
}
.arjs-loader div {
text-align : center;
font-size : 1.25em ;
color : white;
}
</ style >
< body style ="margin : 0px; overflow: hidden; ">
<!-- minimal loader shown until image descriptors are loaded -->
< div class ="arjs-loader ">
< div > Loading, please wait...</ div >
</ div >
< a-scene
vr-mode-ui ="enabled: false; "
renderer ="logarithmicDepthBuffer: true; precision: medium; "
embedded
arjs ="trackingMethod: best; sourceType: webcam;debugUIEnabled: false; "
>
<!-- we use cors proxy to avoid cross-origin problems ATTENTION! you need to set up your server -->
< a-nft
type ="nft "
url ="https://raw.githack.com/AR-js-org/AR.js/master/aframe/examples/image-tracking/nft/trex/trex-image/trex "
smooth ="true "
smoothCount ="10 "
smoothTolerance =".01 "
smoothThreshold ="5 "
>
< a-entity
gltf-model ="https://raw.githack.com/AR-js-org/AR.js/master/aframe/examples/image-tracking/nft/trex/scene.gltf "
scale ="5 5 5 "
position ="150 300 -100 "
>
</ a-entity >
</ a-nft >
< a-entity camera > </ a-entity >
</ a-scene >
</ body >
Now, scan this image!
Change add-your-latitude and add-your-longitude with your latitude and longitude, without the <>.
Look around. You should see the text looking at you, appearing in the requested position, even if you look around and move.
<!DOCTYPE html>
< html >
< head >
< meta charset ="utf-8 " />
< meta http-equiv ="X-UA-Compatible " content ="IE=edge " />
< title > GeoAR.js demo</ title >
< script src ="https://aframe.io/releases/1.6.0/aframe.min.js "> </ script >
< script src ="https://unpkg.com/aframe-look-at-component@1.0.0/dist/aframe-look-at-component.min.js "> </ script >
< script src ="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar-nft.js "> </ script >
</ head >
< body >
< a-scene
vr-mode-ui ="enabled: false "
arjs ="sourceType: webcam; videoTexture: true; debugUIEnabled: false; "
>
< a-text
value ="This content will always face you. "
look-at ="[gps-camera] "
scale ="120 120 120 "
gps-entity-place ="latitude: 40.11246109008789; longitude: -88.22831726074219; "
> </ a-text >
< a-camera gps-camera rotation-reader > </ a-camera >
</ a-scene >
</ body >
</ html >
<!DOCTYPE html>
< html >
< head >
< script src ="https://aframe.io/releases/1.4.2/aframe.min.js "> </ script >
< script src ="https://cdn.jsdelivr.net/npm/ar.js@3.4.3/aframe/build/aframe-ar.js "> </ script >
</ head >
< body style ="margin: 0; overflow: hidden; ">
< a-scene embedded arjs >
<!-- Marker -->
< a-marker preset ="hiro ">
< a-box
position ="0 0.5 0 "
material ="color: red; "
animation ="property: rotation; to: 0 360 0; loop: true; dur: 3000 ">
</ a-box >
</ a-marker >
<!-- Camera -->
< a-entity camera > </ a-entity >
</ a-scene >
</ body >
</ html >
Now, scan this image!