Hi guys. .I have a 3D model in Three.js and dimension of my floor is

dimension in blender >>> x: 6.3metr , y:0metr , z: 6.71metr

In three.js I use this code:

```
// Calculate the mesh size along the desired axes
const meshSize = new THREE.Vector3();
selectedObject.geometry.computeBoundingBox();
selectedObject.geometry.boundingBox.getSize(meshSize);
console.log('SIZE 2 my selectedObject meter', meshSize)
```

But result is this

Vector3 {x: 12.60858678817749, y: 13.412331104278564, z: 0}

How Can I match them ? I need real size dimensions in Three.js

Does this work for you?

Blender.x = Three.x / 2

Blender.y = Three.z / 2

Blender.z = Three.y / 2

Note that this is *only* the size of the geometry in local coordinate space. If the mesh attached to that geometry has a scale, or any parent of the geometry has a scale, then this alters the in-scene size of the geometry. Because youâ€™re seeing dimensions scaled 2x, it sounds like the mesh or one of its parents may contain a 2x scale?

About the axes, Blender uses +Z for up, three.js uses +Y.

3 Likes

I have fixed this by applying all transforms in the blender.now I have the same sizes in three.js.

But axes different again.

I have handled by this way

result looks good,but I am not sure

```
// Calculate the mesh size along the desired axes
const meshSize = new THREE.Vector3();
selectedObject.geometry.computeBoundingBox();
selectedObject.geometry.boundingBox.getSize(meshSize);
const textureLoader2 = new THREE.TextureLoader();
const textureŮ€baseColor2 = await
textureLoader2.loadAsync(item.baseColor);
textureŮ€baseColor2.wrapS = THREE.RepeatWrapping;
textureŮ€baseColor2.wrapT = THREE.RepeatWrapping;
let width2 = textureŮ€baseColor2.image.width
let height2 = textureŮ€baseColor2.image.height;
let aspecRatio2 = width2 / height2;
let repeatY2;
let mainMin = Math.min(meshSize.x, meshSize.y, meshSize.z)
if (mainMin === meshSize.x) {
meshSize.x = meshSize.z;
meshSize.z = mainMin
}
let otherMax2 = Math.max(meshSize.y, meshSize.z)
if (otherMax2 === meshSize.y) {
repeatY2 = meshSize.y / (height2 / aspecRatio2 * 0.0002645833);
}
if (otherMax2 === meshSize.z) {
repeatY2 = meshSize.z / (height2 / aspecRatio2 * 0.0002645833);
}
const repeatX2 = meshSize.x / (width2 / aspecRatio2 * 0.0002645833)
textureŮ€baseColor2.repeat.set(repeatX2, repeatY2);
textureŮ€baseColor2.colorSpace = THREE.SRGBColorSpace;
```

all of the scales are 1,1,1

and in gltf export blender I set Y+ up.