Quantcast
Channel: Babylon.js
Viewing all articles
Browse latest Browse all 388

Optimizing scene: MergeMeshes makes a copy

$
0
0

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?


Viewing all articles
Browse latest Browse all 388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>