Efficient Augmented Reality for the Web
npm install @ar-js-org/ar.js
master keyword with version tag:
html
Loading, please wait...
vr-mode-ui="enabled: false;"
renderer="logarithmicDepthBuffer: true; precision: medium;"
embedded
arjs="trackingMethod: best; sourceType: webcam;debugUIEnabled: false;"
>
type="nft"
url="your-server/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"
>
gltf-model="your-server/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"
>
`
$3
Please follow these simple steps:
- Create a new project with the following snippet, and change add-your-latitude and add-your-longitude with your latitude and longitude, without the <>.
- Run it on a server
- Activate GPS on your phone and navigate to the example URL
- Look around. You should see the text looking at you, appearing in the requested position, even if you look around and move.
`html
GeoAR.js demo
vr-mode-ui="enabled: false"
arjs="sourceType: webcam; videoTexture: true; debugUIEnabled: false;"
>
value="This content will always face you."
look-at="[gps-camera]"
scale="120 120 120"
gps-entity-place="latitude: ; longitude: ;"
>
`
$3
Please follow this simple steps:
- Create a new project with the code below (or open this live example and go directly to the last step)
- Run it on a server
- Open the website on your phone
- Scan this picture to see content through the camera.
`html
position="0 0 0"
scale="0.05 0.05 0.05"
gltf-model="your-server/https://raw.githack.com/AR-js-org/AR.js/master/aframe/examples/image-tracking/nft/trex/scene.gltf"
>
`
Important! Be aware that if you are referring to external resources, in any app, especially those using NFT, you will encounter CORS problems if those resources are not in the same server of the code. If you can’t see the tracking, please open your Browser Dev Tools and check if you have CORS errors in the console. If so, you have to fix those errors in order to see your content. The correct fix is to place your resources on the same server of your code.
If you cannot do that, you can host a proxy anywhere server to solve that (https://github.com/Rob--W/cors-anywhere).
Please note that several hosting services have policies that does not permit to use such server. Always check hosting services policies before using them to avoid account suspensions
Learn more on the AR.js Official Documentation.
ES6 npm package
You can install AR.js with npm and use in any compatible project that support npm modules (React.js, Vue.js, Next.js or whatelse), to install it run:
`
// Install with npm
npm install @ar-js-org/ar.js
`
`
// Install with yarn
yarn add @ar-js-org/ar.js
`
For some examples read this issue.
$3
With the updates 3.4.6, three.js can now be imported using the ES module syntax.
To align with this standard, ar-threex.mjs,ar.mjs and ar-threex-location-only.mjs should also be imported in the same way using an import map. Here is an example of how to import these modules in your project:
`html
// Example importing ar-threex.mjs
``