Hi guys, here is the PG example, which I found similar to my problem.
I’m loading .glb file created by OCCT to BJS, using the function BABYLON.appendSceneAsync.
The problem is I wish to not create root node that is the parent of my real mesh, and I tried to use pluginOptions->gltf->customRootNode = null, and I did not see any changes, it still returns 2 meshes for me, one is root and one is node1.
Wish for help guys!
Here is the working PG example - https://playground.babylonjs.com/#WGZLGJ#10520
Hope it may help
Hi thanks for checking my question!
I did try your PG example, seems that using legacy method is preferred to solve this?
I’ve noticed the line of code “plugin.customRootNode = rn;”, however I didn’t see the difference with or without it. I checked the meshes on the scene by calling
setTimeout(()=>{
console.log(scene.meshes)
}, 2000)
And there is only one mesh with or without that plugin setup…
So I think maybe there is still a problem…
cc @ryantrem to have a look as he added the options recently
@labris you need to set the plugin callback outside of the append function or it will only works on the second call https://playground.babylonjs.com/#WGZLGJ#10521
This still highlights an issue when used in the options that @ryantrem might have a look into.
This one is really cool.
BTW, an extra quick question
I found it not work when I changed line 9 to following:
const rn = new BABYLON.TransformNode(“myroot”, scene);
So what is the difference between AbstractMesh and TransformNode? And why I can’t replace it?(Cuz the BabylonDoc told me to do this!)
It works for me here https://playground.babylonjs.com/#WGZLGJ#10523, not for you ?
@sebavan Thanks for the correction!
nw I only got it cause I opened your example in a fresh browser
Not really, I just rechecked, TransformNode is not creating parent mesh, the scene has only model and skybox 2 meshes when with it.
If I open this https://playground.babylonjs.com/#WGZLGJ#10523, I can see:
where myroot is the transformnode parent of the boombox
Cool, maybe it’s cuz I used scene.meshes to check all the meshes and TransformNode is not a type of mesh, I got it right?
yup https://playground.babylonjs.com/#WGZLGJ#10524
scene.meshes holds the meshes only and scene.transformNodes for the other.
Thanks for the heads up on this issue. There was a small logic bug that was something like finalOption = passedInOption ?? defaultOption
, which is incorrect when passedInOption
is null
and defaultOption
is undefined
(the case for customRootNode
). This is addressed in Don’t overwrite null root node with undefined default by ryantrem · Pull Request #15474 · BabylonJS/Babylon.js (github.com)
Really cool for you to fix that! I just watched from GH.
Like this team and the source code!