# Dynamic load model with "Image Target"

**URL:** <https://forum.8thwall.com/t/dynamic-load-model-with-image-target/977>\
**Category:** Technical Support\
**Created:** [April 4, 2024, 9:16am UTC](https://forum.8thwall.com/t/dynamic-load-model-with-image-target/977 "2024-04-04T09:16:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nhan\_Trong](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/nhan_trong/32/507_2.png) [@Nhan\_Trong](https://forum.8thwall.com/u/Nhan_Trong)\
**Post date:** [April 4, 2024, 9:16am UTC](https://forum.8thwall.com/t/dynamic-load-model-with-image-target/977/1 "2024-04-04T09:16:21Z")

</div>

I built a project with about 10 image targets, corresponding to 10 models.  
Loading all 10 models when loading the page takes quite a while. I want to know if there is a way to dynamically load a model after scanning the target image (only load that model). While waiting for loading, I will display a loading model…  
The expected flow is:

- Scan target image
- xrimagefound =\> detect model, show loading model
- Load detected model
- Run animation of the model

Can I do it with such a flow? and what solution to dynamically load the model?  
Please help me.

---

<div class="post-metadata">

**Author:** ![Rickard\_Elimaa](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/rickard_elimaa/32/202_2.png) [@Rickard\_Elimaa](https://forum.8thwall.com/u/Rickard_Elimaa)\
**Post date:** [April 5, 2024, 6:32am UTC](https://forum.8thwall.com/t/dynamic-load-model-with-image-target/977/2 "2024-04-05T06:32:08Z")

</div>

Are you going to have several models active at the same time?

---

<div class="post-metadata">

**Author:** ![Nhan\_Trong](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/nhan_trong/32/507_2.png) [@Nhan\_Trong](https://forum.8thwall.com/u/Nhan_Trong)\
**Post date:** [April 5, 2024, 7:18am UTC](https://forum.8thwall.com/t/dynamic-load-model-with-image-target/977/3 "2024-04-05T07:18:42Z")

</div>

Yes, 10 models will be active at the same time so that when the image is scanned, the model will be displayed.

---

<div class="post-metadata">

**Author:** ![Rickard\_Elimaa](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/rickard_elimaa/32/202_2.png) [@Rickard\_Elimaa](https://forum.8thwall.com/u/Rickard_Elimaa)\
**Post date:** [April 5, 2024, 9:19am UTC](https://forum.8thwall.com/t/dynamic-load-model-with-image-target/977/4 "2024-04-05T09:19:45Z")

</div>

Could you show me what you have got so far?

I mainly need what’s inside `<a-scene>` and only one of your image targets. If you made any special components in javascript for your image target, please add that code as well.

Also, be sure to use the \</\> icon in the menu above the textfield when pasting the code.

---

<div class="post-metadata">

**Author:** ![Nhan\_Trong](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/nhan_trong/32/507_2.png) [@Nhan\_Trong](https://forum.8thwall.com/u/Nhan_Trong)\
**Post date:** [April 8, 2024, 9:03am UTC](https://forum.8thwall.com/t/dynamic-load-model-with-image-target/977/5 "2024-04-08T09:03:55Z")

</div>

That’s just the idea, I want to see if this method is feasible?

---

<div class="post-metadata">

**Author:** ![Rickard\_Elimaa](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/rickard_elimaa/32/202_2.png) [@Rickard\_Elimaa](https://forum.8thwall.com/u/Rickard_Elimaa)\
**Post date:** [April 8, 2024, 9:29am UTC](https://forum.8thwall.com/t/dynamic-load-model-with-image-target/977/6 "2024-04-08T09:29:38Z")

</div>

You can dynamically set the src of the model inside an entity with `xrextras-named-image-target`, so what you’re asking is feasible. However, the user will have to wait for the actual model to load whenever an image target is found.

To avoid this, I would probably delay the preloading of all the models with a `setTimeout` after the whole page has loaded. Like, download all models 5 seconds after the camera shows up.

---

<div class="post-metadata">

**Author:** ![Nhan\_Trong](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/nhan_trong/32/507_2.png) [@Nhan\_Trong](https://forum.8thwall.com/u/Nhan_Trong)\
**Post date:** [April 8, 2024, 9:32am UTC](https://forum.8thwall.com/t/dynamic-load-model-with-image-target/977/7 "2024-04-08T09:32:35Z")

</div>

That’s a good idea, thank you very much
