Normalize to cube (only apply to height)

I’m using this function AbstractMesh | Babylon.js Documentation to normalize avatars so all different avatars will have the same height. However, this doesn’t work so well if the avatars arms (in t-pose) are longer than the avatars height. Is there a way to use normalizetounitcube so it only applies to the Y-axis or is there a way to change the unit cube dimensions?

1 Like

I would use the bounding infos and rescale based on that. something like:

const height = mesh.getBoundingInfo().boundingBox.extendSizeWorld.y;
const myRatio = desiredHeight / height ;
mesh.scaling = new Vector3(myRatio, myRatio, myRatio);
1 Like

actually, I have to use mesh.getHierarchyBoundingVectors()
because the mesh is from a GLB file, but this works very well thank you!

1 Like