Comments (5)
You could use the markerFound
event to detect when the marker is visible and then read the world position of the model so you can place whatever you want in that position of the screen.
For easier handling, you will probably need two references of the model so you can initially show it on top of the marker and then hide it and show a different one in that world position.
Check out here how to use three.js in a-frame:
https://aframe.io/docs/1.2.0/introduction/developing-with-threejs.html
And here's how to get world position of a 3D object in three.js:
https://threejs.org/docs/#api/en/core/Object3D.getWorldPosition
from arjs-gestures.
Thanks for answering,I try first
from arjs-gestures.
oh , I finished,Thanks!
from arjs-gestures.
@hahaxiaowai could you share an example of how you achieved this?
from arjs-gestures.
@hahaxiaowai could you share an example of how you achieved this?
My way of implementation may not be what you want,I just add the model to it when the markerFound is triggered,Then change the model's rotate and scale accordingly when handleRotation and handleScale are triggered
this.el.sceneEl.addEventListener("markerFound", (e) => {
this.isVisible = true;
const scene = document.querySelector("a-scene").object3D;
const loader = new THREE.GLTFLoader();
loader.load("building.gltf", (gltf)=> {
const model = gltf.scene;
model.position.set(0, 0, -10);
model.scale.set(0.0005, 0.0005, 0.0005);
model.traverse(function (child) {
// if ( child.isMesh ) child.material.envMap = envMap;
});
this.model = model;
scene.add(model);
});
});
from arjs-gestures.
Related Issues (19)
- Can't manipulate the model (not via marker)
- How to use the example under vue or ES6 module? HOT 2
- Camera error HOT 3
- Multiple object HOT 1
- Customise scaling of height and width HOT 7
- Can this work with the location-based method? HOT 3
- How to stop animation on touch HOT 1
- How Can I set autorate?
- The second example does not work ! HOT 2
- Disable vertical rotation HOT 6
- How can i can moving object3d by onefingermove? HOT 2
- It doesn' work in PC like Chrome browser
- About AR marker HOT 4
- Nice work! How to change the marker?Thank you! HOT 1
- issue HOT 1
- How to replace other photos HOT 1
- Image Tracking
- Loading multiple models HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arjs-gestures.