About mesh sizes, scaling in onMeshLoaded event

Hi all…

I’m importing gltf files with importmesh method, at the onMeshLoaded event of this method i’m trying to handle mesh scaling.

But; when i try to console.log(mesh.scaling + “skala values”); it’s logging {1, 1, 1};
when i logging the mesh and check the down nodes i see it’s different values in there.

And also in this topic About mesh positions and sizes in gltf files i was try it result not changed…

sorry for my bad english…

I need some help about this…

If you’re already using mesh.scaling = new BABYLON.Vector3(scale_x, scale_y, scale_z); then I would assume it’s an issue with your render loop. Try setting the scale in a RegisterBeforeRender() function. If you’re new to GPU processing, then this is an essential component of most any rendered geometry.

Galen

1 Like

@Buzul Can you create a playground with a repro? That will help us understand your issue.

1 Like

Hi again;
@Galen i try that but it’s undefined…
@bghgary you can find my pg link below. In this sample “Path” is not defined.

How can i handle mesh scaling values? I need this because i will re-scale other mesh with those values.

Thank you…

https://playground.babylonjs.com/#LSBI4Y#1

I;m not able to load your mesh from the PG scene. Although I can see that you’re loading meshes inside the render loop from the code you provided.

If you want to load a mesh and adjust scaling I recommend using RegisterBeforeRender function as this will create adjustments to your mesh outside of the render loop. Otherwise, your mesh will import at the default value of (1,1,1) on X Y and Z.

Remember that your render loop is set to render what is already in your scene to optimize memory.

Galen

3 Likes

Thank you i solved it following with your sample…