qqqzhch
February 20, 2022, 3:46am
1
Refer to this post
Hey @wilcoschoneveld Welcome to the Babylon Family! So great to have you here!!!
Good questions.
I’m bringing in @bghgary to correct me if I’m wrong about some of this.
Blender is a z-up right handed world.
Babylon is a y-up left handed world.
To complicate things, .gltf is also a right handed coordinate system.
Because the coordinate systems are different, there has to be conversion that happens between them.
This happens on the Babylon gltf importer. Whenever you import a .gltf object, …
The parent level of the imported model is removed, but the model is not displayed
This is my example
let snowBall = await BABYLON.SceneLoader.ImportMeshAsync("","scenes/BoomBox/", "BoomBox.gltf", scene);
console.log('async',snowBall);
const snowBallParent = snowBall.meshes[0];
snowBall = snowBallParent.getChildMeshes().slice(1);
snowBall.forEach((son)=>{
son.setParent(null);
});
snowBallParent.dispose();
Blake
February 20, 2022, 4:20am
2
Heya, the root mesh only had one child mesh so slice(1) was returning an empty array. So I just changed it to slice(0) and it’s working.
[PG](https://playground.babylonjs.com/#WGZLGJ#4450
qqqzhch
February 20, 2022, 12:12pm
3
After I removed the parent node and changed the texture in gltf, the texture map was still wrong. Is there any step I missed
function fixImg(scene){
const id ='Rectangle2059392382';
const imgmesh = scene.getMeshByID(id);
imgmesh.material.emissiveColor=Color3.White();
//mesh.material, "emissiveColor", Color3.White()
imgmesh.material.emissiveTexture=new Texture('/img/13470259.jpg');
console.log(imgmesh);
}
Blake
February 20, 2022, 3:02pm
4
Trying passing false to not invert the texture (for the fourth param). Otherwise will prob need a PG for it.
new Texture('/img/13470259.jpg', scene, true, false)
1 Like
qqqzhch
February 23, 2022, 7:07am
5
I found that after the root of transformnodes is removed, the child node mapping of transformnodes is still wrong
sebavan
February 23, 2022, 2:50pm
6
not sure what you mean @qqqzhch could you share a playground highlighting your issue ?
1 Like
Blake
February 23, 2022, 4:34pm
7
I think the problem is that your’e removing the parent from all descendants of the root mesh, not just its direct descendants. If you pass true to getChildMeshes() then you can remove the parent for just the meshes that have the root mesh as their parent. Otherwise if there’s still an issue a new PG will help us get to the bottom of it.
snowBall = snowBallParent.getChildMeshes(true).slice(0);
1 Like