I am quite new to using babylon and this is an amazing tool, I can’t thank you enough for that
I am trying to play with radio buttons letting me show or hide different meshes.
I had 3 meshes. A monkey exported from blender, the classic skull found on internet and a very simple torus from 3dsMax with no materials.
It worked great, i managed to do that successfully on these meshes and even change their colors etc.
I then tried to replace my torus by another mesh exported from 3dsMax but this one with textures (the IronMan).
But… IronMan never wants to disappear no matter what I do. I have tried a bunch of methods, .setEnabled(false); .dispose(); etc none of them having any effect on the IronMan, damn tony stark.
Here is my code (pretty simple), with the 3 babylon meshes that I use.
Do you guys have any idea?? This seems like a bug to me
PS: Also, if you have any advice to avoid using those global variables, I would gladly take that
The thing is that the playground does not support external html code etc and in my case I have to interact with my babylon window from outside, this is why I used Radio Buttons.
I am afraid that if I use babylon to create GUI buttons in the playground this will fix my error assuming that the whole logic will be different, but this will not solve my problem, because I have to use external buttons…
Well if you post here this is because you consider the problem is not on your code So a repro should be done in the playground where only babylonjs code runs
If the issue comes from outside of babylonjs then it is all under your control. If the problem can be reproduced in the playground and you can showcase that dispose does not work, I will gladly (and quickly) fix it
Often to trace a problem you need to simplify. It seems that the issue is with the ‘Iron Man’ import. So create a PG that imports the Iron Man. Once you are happy that it loads OK add a dispose() after it loads. No need for radio buttons. If Iron Man does not dispose then there is an issue to check, if it does dispose then the problem lies elsewhere.
I understand your point Deltakosh I will manage to do so in my future posts.
I have figured out what my problem was.
It appears that with imports without materials, calling setEnabled(false) on newMeshes[0] is enough but if there is a material attached to it, you have to do a for loop on the length of it and disable it all. This is what I misunderstood there.
But… I have now another issue which I dont understand.
I can now successfully hide a mesh imported via ImportMesh() but assuming that I want my whole scene to be imported and not only the mesh, I have to use the .append() function, which I can’t manage to dispose.