hiukim / mind-ar-js

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

setAttribute("mindar-image",val) not working #319

Closed GorillaFu closed 1 year ago

GorillaFu commented 1 year ago

Hi,

I'm trying to change the attribute "mindar-image" of an a-scene tag using javascript. Based on user preferences I want to load different mind files.

document.getElementById("main").setAttribute("mindar-image", val);

For some reason, this code is able to change any other attribute in the tag except mindar-image, for example I'm able to change color-space, renderer, vr-mode-ui, only when I put mindar-image it just doesn't change anything, nor does it throw any errors.

Any help would be appreciated!

hiukim commented 1 year ago

Unfortunately, that doesn't work. You cannot change the mindar-image attribute dynamically.

adamb commented 1 year ago

If we want to dynamically load a mind file depending on something like user location, how would we do this if we can't dynamically update the attribute?

Can we create the entire a-scene tag? Or is there a better way to do this?

hiukim commented 1 year ago

Re-creating the a-scene tag is one way to go. Someone pointed out there are memory leak, but I haven't personally tried that.

adamb commented 1 year ago

Adding the full a-scene tag worked, thanks!