Bounding info extendSize and scaling

Hi, I’m trying to get the “dimensions” of a mesh to serialize them in a database.

Here is what I tried :

function getMeshDimensions(mesh) {
    const extendSize = mesh.getBoundingInfo().boundingBox.extendSize.scale(2);
    return {
        width: extendSize.x,
        height: extendSize.y,
        depth: extendSize.z

Although it is working fine when the mesh has a scaling vector equals to (1,1,1), I noticed that the same value is returned if the scaling vector is different.

Here is a PG to illustrate : ExtendSize and scaling | Babylon.js Playground (

How can I get the right dimensions when the scaling is different from (1,1,1) ? I feel like I missed some important information but I was not able to find it.

Thank you you for your help ! :pray:

Is this the right scaling?

You are so right, apparently I missed the ‘extendSizeWorld’ property ! Thank you for your help :pray:

I will just add some precision. The ‘extendSizeWorld’ property gives the “dimensions” along the global axes. It works well if the mesh is aligned with those axes (rotation (0,0,0)), but if it is rotated, the dimensions don’t match the real size of the mesh on each of its local axes.

I found a workaround by reseting the mesh rotation before computing bounding info, and restoring the previous rotation after. (example here : ExtendSize and scaling | Babylon.js Playground ( )

I’ll go with this solution for now but if someone has a shorter/cleaner solution i’d be happy to know it :smiley:

Maybe this: It does match your target.

It seems indeed that it solves the problem. There are some differences far in the decimals because of computations but it’s no big deal for my case.

Thank you for your time :pray: