0

Good day guys

I want to cange a .dae dynamically with this in js

AFRAME.registerComponent('model-overrider', {
        init: function() {


          document.querySelector('#tree').setAttribute('src',modelo);


   }

and the html looks

   <a-assets >  
       <a-asset-item id="tree" src=" "></a-asset-item>  
    </a-assets>

      <a-entity collada-model="#tree" model-overrider></a-entity>

but I can´t make it work

thanks for your help,

sincerely,

Diego Ramirez.

1 Answer 1

2

I believe we cannot assign a new src to an a-asset-item dynamically. Instead, we can set the a-entity's collada-model as follows:

var e = document.querySelector('#myEntity');
e.setAttribute("collada-model", 'url(tree.dae)');
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.