Search the Community
Showing results for tags 'merged mesh center'.
-
Hi, We have been using babylon2.5 (oddly, an alpha release) in our projects because it served our purposes. Now we want to update to 3.0.7 for various reasons. We have lots of meshes that are imported into an existing scene that have to be logically combined under a parent based on a predefined config. I used this following code to arrive at combination's size and center. var getCombinationData = function(meshes) { var clones = []; for (var i = 0; i < meshes.length; i++) { clones.push(meshes[i].clone("clone" + i)); } var combinedMesh = BABYLON.Mesh.MergeMeshes(clones); var boundingBox = combinedMesh.getBoundingInfo().boundingBox; var size = boundingBox.extendSize.scaleInPlace(2); var center = boundingBox.center; //dispose off the clones; for (var k = clones.length; k > 0; k--) { clones[k - 1].dispose(); } combinedMesh.dispose(); return { size: size, center: center }; }; Using babylonjs 3.0.7, the boundingBox.center is different from that obtained using 2.5, which I am assuming is right , because a box made with size and center got from the above method, neatly encapsulated the meshes. Has anything changed since 2.5 or An easy fix to doing this? The meshes can have parents ( but not different ones). Thanks.