Very complex issue.
Units are something that basically don’t exist in the 3D world. So what is 1 unit in Babylon. Best answer is, whatever you want it to be.
Let’s see some example in practice. Let’s say that in 3D software you create 3 models.
- Model created as 1x2x3cm box.
- Model created as 1x2x3m box
- Model created as 1x2x3in box
You export this, and import in Babylon. What will happen is that every box will look the same, and every box will be 1x2x3 box (note: unitless).
So basically, you can get the values, but not the units inside the Babylon.
So basically, there is no good solution here. You need to figure out some workaround. For example, what I did in my editor is that I allowed the user to choose the units (basically, even in 3dsMax, if you go to unit settings, you have “display units” and “system units”, indicating that even in 3D software, units are just a convention that you choose. Basically, I created “system units” selection from dropdown menu, as you can see in image bellow.
With that said, FBX format kinda solved this issue, and the FBX file itself is carrying the information about units inside the file itself, and you can parse the file and extract that value. Basically it has something like “unitFactorScale” property inside the file, which shows certain value that represents the unit (100=>meters, 1=>cms, and so on).
Now as Babylon doesn’t support FBX, you need some server side code for this. So you get the FBX file, parse it, extract the value, send it to front, and then convert FBX to GLB, and import in Babylon.
Any other format is completely unitless, and you cannot get the information about the units.