Sign in to follow this  

Help updating from 2.5 to 3.0.7. Something changed with merged mesh position?

Recommended Posts


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 =;

        //dispose off the clones;
        for (var k = clones.length; k > 0; k--) {
            clones[k - 1].dispose();

        return {
            size: size,
            center: center

Using babylonjs 3.0.7, the 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).


Share this post

Link to post
Share on other sites

Hi @Deltakosh,

No luck with computeWorldMatrix. I already tried centerWorld, but using that also causes offsets. I would be needing the center in world space but sometimes the meshes that are combined have a parent, in that case the center should be relative to the parent. I will see if transforming worldCenter to parent space would work.

And its strange because I tried my code in playground and it seems to work right. I guess there is something else.

Share this post

Link to post
Share on other sites

I can confirm (with much relief) , that this is case with 3.0.7 but the current preview (3.1-beta2) renders correctly.

I will have to check everything before continuing with this preview release, but it looks great. Moreover , we have nearly doubled the potential FPS. What a win!!!!. 1000 points to everyone.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.