Hi Team,
I have a problem using LoadAssetContainerAsync to load partial assets to the scene. I want to load a mesh from a glb file which contains a full character, I mean meshes have skin data and transfernodes link to the skeleton. But I only want to load the meshes as the scene already have a same skeleton as the one in glb. What I did is
- mesh.skeleton = scene.skeletons[0]
- dispose the skeleton.
- dispose the transfernodes.
- container.addAllToScene()
Finally I found when I dispose the skeleton, the attribute _isDispose was set as True but still was added to the scene.
I wonder if it is a bug or a feature? Is there any efficient way to load partial assets to the scene without disposing anything from a glb file?
PS: I use npm version which is 4.26.
Hey can you repro in the PG because I’m not sure I understand what you are doing
You are calling skeleton.dispose() so it is expected for the skeleton to have isDispose set to true
Calling mesh.skeleton = scene.skeletons[0]
does not make a copy of it
If this is what you want you have to run this:
mesh.skeleton = scene.skeletons[0].clone()
Hi,
Thank you for your concern. I cannot repro this issue in the PG, it looks fine, but I can still provide this one https://playground.babylonjs.com/#S7E00P#105 for explaining what I did. Consider the PG is 5.0.0alpha38, the problem occurred when I use the public version from npm, which is 4.26. So it is safe to use 5.0 version? What I want show is when I am trying to dispose the skeletons in the second assetContainer, the skeletons still there but _isDisposed is set as True, which leads to the scene still have the duplicate skeleton.