TLDR: There is a discrepancy between the scaling factor of a mesh within the BabylonJS Editor and within a running instance of a BabylonJS game. I export a mesh’s position and scaling values from the Editor and try to instantiate meshes with those values in my game, but the scaling of the instantiated meshes don’t match in terms of appearance with the meshes from the Editor. As a workaround, I multiply the scaling values by 5 to get them to look as expected. Can anyone help me figure out if there’s something I’m doing wrong so I can avoid having to hack a way around it?
I have been working on a simple export function on and off. After getting lots of help from this forum previously I was able to complete the function and export my scene data from the BabylonJS Desktop Editor into JSON format. At that point I thought I was done with the function and continued to work on the logic within the actual game. Last night I reached a point in development where I was able to finally make use of the exported data and attempt to iterate through the JSON and instantiate the meshes I had exported. I was able to complete that without much ado, however, all of the meshes ended up in sizes that I did not expect and looked unrecognizable from what they appeared within the BabylonJS editor. After some analysis I think the issue is that the scaling of the mesh objects are inconsistent between the BabylonJS Editor “world” and when they get brought into my game .html file.
How is this possible? Like I stated in my other post, I am a newbie to BabylonJS and to game dev in general, so I may be missing some very simple concepts and blowing things way out of proportion. Please see below screenshots to illustrate what I mean (playground):
As you can see, within the Editor, the squares are stacked nicely on top of each other. However, if I take the same position/scaling values of the meshes from the Editor and dump them into a game/playground, they are spread out by 3 or 4 units. If I adjust the scaling of the meshes to 5 times the exported value, then I see a result that more closely aligns with what I’m expecting to see. Please see below (playground):
I would like to avoid doing this workaround for my code, if possible. Could anyone help me understand why it is happening and if it’s avoidable?