Threedy Posted January 9, 2016 Share Posted January 9, 2016 Hi, I have an array of boxes (which are all cloned from an initial box), placed next to each other (as one long box). I want to merge these boxes together. Using the following function, I've managed to merge them together (as far as I know):var newMesh = BABYLON.Mesh.MergeMeshes(sceneObjects.boxes, false, false,false); My questions are: 1. If I move this newMesh (e.g. newMesh.position.x = 100), I see my old boxes at the exact same position too. How can I remove these ''old'' boxes? 2. I quote this wiki: https://github.com/BabylonJS/Babylon.js/wiki/How-to-merge-meshes: Note: Careful, when you merge cloned mesh, you need to update the world matrix of the mesh with computeWorldMatrix before calling the function.So if I understand correctly, I need to call computeWorldMatrix() on the mesh I clone? Not on the newMesh object? Quote Link to comment Share on other sites More sharing options...
iiceman Posted January 9, 2016 Share Posted January 9, 2016 Hi Threedy and welcome to the forum! As you can see here http://doc.babylonjs.com/classes/2.2/Mesh#static-mergemeshes-meshes-disposesource-allow32bitsindices-meshsubclass-rarr-mesh-classes-2-2-mesh- the second parameter is about disposing the source meshes. So just try to use it with the second parameter true:var newMesh = BABYLON.Mesh.MergeMeshes(sceneObjects.boxes, true, false, false); By the way: do you know the babylon playground: http://www.babylonjs-playground.com/ You can create examples there and show us directly what problem you have and we can edit the code and try things out to help you solve your problem. I made a playground that shows your problem: http://www.babylonjs-playground.com/#1GCRKJ#0 Try it out and switch between line 36 and 37 to see the difference. Hope that helps Let us know if that answered your question or if we can help you with anything else! jerome 1 Quote Link to comment Share on other sites More sharing options...
Threedy Posted January 9, 2016 Author Share Posted January 9, 2016 Ah, totally missed that parameter! Thanks for the help & tip iiceman! Threedy 1 Quote Link to comment Share on other sites More sharing options...
iiceman Posted January 9, 2016 Share Posted January 9, 2016 You are very welcome! Don't forget to keep us up to date about how your project goes Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.