jeromeetienne / AR.js

Efficient Augmented Reality for the Web - 60fps on mobile!
MIT License
15.79k stars 2.22k forks source link

i want to load a gltf model in the multiple marker concept #462

Closed ashwinkapure closed 4 years ago

ashwinkapure commented 5 years ago

i was able to load a gltf model through a-frame for AR, here i faced an issue that when the camera is away from the marker the model disappears , here i studied the multimarker concept but i an new to javascript, the code on github shows how to load a box and torus which is code generated, it would be helpful if anyone can help me loading a gltf model instead.

droid001 commented 5 years ago

It's the same concept as with geometric objects. Just swap out the box or torus with an entity which contains a gltf model. Check out the a-frame documentation: https://aframe.io/docs/0.8.0/components/gltf-model.html

ashwinkapure commented 5 years ago

It's the same concept as with geometric objects. Just swap out the box or torus with an entity which contains a gltf model. Check out the a-frame documentation: https://aframe.io/docs/0.8.0/components/gltf-model.html

thankyou very much for quick reply, i have done the above suggestion at the beginning and its working smoothly, please find the below code

    AR.js/three.js/examples/multi-markers/examples/player.html

i found the above code in the AR.js multimarker examples, here this code is in javascript and has the multimarker concept working. here as i am new to javascript i dont know how to add a gltf model instead of the box and torus

commentatorboy commented 5 years ago

This is the code used for multimarker: https://github.com/jeromeetienne/AR.js/blob/master/three.js/examples/multi-markers/examples/player.html It does not look like that it uses a-frame rather just threex and other. I suspect that none of them would work with gltf. But you can experiment with it. Firstly include a-frame. secondly use the example here: https://aframe.io/docs/0.9.0/components/gltf-model.html#example thirdly replace the object created around here: link with gltf.

Poojahm3 commented 4 years ago

hi, when i replace the src link to my new gltf model it stops working. i dont know whats wrong.

this is working exmple. how can i put my own gltf model on scanning hiro marker

Poojahm3 commented 4 years ago

Screenshot from 2019-12-20 15-18-37 this is my example code. how i can put new gltf file in that.. if i edit src link it doesn't work

commentatorboy commented 4 years ago

Can you open your browsers developer console, when running the code? (Usually through f12). And post/screenshot the errors. I suspect that it is because it can not find the gltf.