Closed dottodot closed 2 years ago
I've never used MergeMeshes, but it looks like it ought to work - was just reading the docs here: https://doc.babylonjs.com/divingDeeper/mesh/mergeMeshes
One thing that I do is parent to a rootmesh in the Component, so this may work:
const onModelLoaded = ({rootMesh}) => {
const merged = Mesh.MergeMeshes([rootMesh]);
console.log(merged);
};
I would probably drop down to the hook itself as likely you want to dispose the original meshes (2nd parameter). The component is here - it's mainly a wrapper that calls a hook and disposes the model on component unmount: https://github.com/brianzinn/react-babylonjs/blob/master/packages/react-babylonjs/src/customComponents/Model.tsx
Are you able to share a code sandbox otherswise?
Closing from inactivity and no reply - I am unable to reproduce locally. Please re-open if you have more feedback - thank you.
I'm trying to merge meshes on a loaded model but it always returns
null
and I'm not sure if it's react-babylonjs issue or not.I'm using this https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/Box/glTF-Binary/Box.glb and implementing as follows.
If I use a mesh created using MeshBuilder it works as expected.