hiukim / mind-ar-js

Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js
MIT License
2.12k stars 391 forks source link

How to import custom 3d model #522

Open errwnd opened 2 months ago

errwnd commented 2 months ago

I'm wokring on a new project, and I want to import a new model to the project. Is that possible? I tried it by changing the src in a face tracking example. It didn't work. Is there such a feature?

seantai commented 2 months ago

what didn't work? can you post your code?

errwnd commented 2 months ago
      <a-asset-item id="earringModel" src="scene.gltf"></a-asset-item>

scene.gltf is a local 3d image, but that is not getting loaded to the scene

seantai commented 2 months ago

that is simply loading the asset. additionally you need to "render" it to an anchor with something like this

 <a-entity mindar-face-target="anchorIndex: 127">
   <a-gltf-model rotation="-0.1 -0 0" position="0 -0.3 -0.3" scale="0.05 0.05 0.05" src="#earringModel" class="earring-entity" visible="false"></a-gltf-model>
</a-entity>

https://hiukim.github.io/mind-ar-js-doc/face-tracking-examples/tryon