Is there a method similar to scaleTo() in babylonjs? When the model size is unknown, it is directly scaled to the specified size instead of using the scaling ratio method of scale (1.0)

Is there a method similar to scaleTo() in babylonjs? When the model size is unknown, it is directly scaled to the specified size instead of using the scaling ratio method of scale (1.0)

1 Like

Any Mesh has a function called normalizeToUnitCube that normalizes the size of the mesh and its decedents to a 1x1x1 cube. is that something that can help you?

glTF Loader Demo | Babylon.js Playground (babylonjs.com)

3 Likes

Building on that, I use the following after import:

mesh.normalizeToUnitCube(true,true)        
mesh.scaling.scaleInPlace(worldUnitScale)
mesh.computeWorldMatrix(true) // invalidate cached
mesh.bakeCurrentTransformIntoVertices(false); // not independent of children
3 Likes