Initial coordinates of mesh's boundingInfo

I’m having some trouble calculating center.

    cube = BABYLON.MeshBuilder.CreateBox('cube', {  }, scene);
    cube.position.x = 5;
    console.log(cube.getBoundingInfo().boundingBox.centerWorld);

returns 0,0,0
I’ve tried refreshBoundingInfo, _updateBoundingInfo, boundingSphere, _boundingInfo
results all same

I’m trying to retrieve these coordinates to construct a new mesh based on the first one’s origin

Nevermind… I had a tab open with the exact answer.

    cube = BABYLON.MeshBuilder.CreateBox('cube', {  }, scene);
    cube.position.x = 5;
    cube.computeWorldMatrix(true);
    console.log(cube._boundingInfo.boundingBox.centerWorld);

works!

1 Like