Giter VIP home page Giter VIP logo

Comments (5)

FireDragonGameStudio avatar FireDragonGameStudio commented on May 27, 2024 1

Thank you for the swift reply, I'll just use webpack or another bundler for testing then. Was just curious why it's not working on Glitch.

br,
Max

from ar.js.

nickw1 avatar nickw1 commented on May 27, 2024 1

@FireDragonGameStudio for info - there is now a new tutorial for location-based three.js, at: https://ar-js-org.github.io/AR.js-Docs/location-based-three/

from ar.js.

nickw1 avatar nickw1 commented on May 27, 2024

Hello Max,

I'm not sure why this is happening, it's related (I would imagine) to how the AR.js bundle is built. It looks like you can't mix the use of an importmap for three.js with the built AR.js location-based bundle. @kalwalt - any ideas?

You can get it to work by installing AR.js via npm and using webpack to build. For example:

{
    "dependencies": {
        "@ar-js-org/ar.js": "3.4.2"
    },
    "scripts": {
        "build": "npx webpack"
    }
}

and the webpack.config.js as follows:

module.exports = {
	mode: 'development',
	entry: './script.js',
	output: {
		path: path.resolve(__dirname, 'dist'),
		filename: 'bundle.js'
	},
	optimization: {
		minimize: false
	}
};

and then link to bundle.js from your HTML.

Also in the JavaScript source, import the modules as follows:

import * as THREE from 'three';
import * as THREEx from '@ar-js-org/ar.js/three.js/build/ar-threex-location-only.js'

I am intending to update the docs soon to reflect this.

Hope that helps.

from ar.js.

nickw1 avatar nickw1 commented on May 27, 2024

I don't think it's Glitch specific, the same problem also occurs when testing on a local machine - but I am not sure myself as I didn't develop the bundling process.

from ar.js.

nickw1 avatar nickw1 commented on May 27, 2024

Closing this now as I believe it has been resolved.

from ar.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.