Glb scaling mystery ("cannot read property length squared of undefined")

in this glitch https://gevurahmodeltests.glitch.me (my vr model test site), when I fire off this line:

task.loadedMeshes[0]._children[1].scaling = BABYLON.Vector3(1000,1000,1000);

I get this error: Uncaught TypeError: Cannot read property ‘lengthSquared’ of undefined

this is kind of looking like an internal babylon thing, right?

Seems that is also (and most probably) could be just because some of your variables are undefined.
This error indicates that the code expects to have an object with a lengthSquared property, but that object was not present.
As far as I can see from this line of your code, you didn’t create the new Vector3 object - should be like

task.loadedMeshes[0]._children[1].scaling = new BABYLON.Vector3(1000,1000,1000);

If you don’t want to create new object, you may use 3 lines of code, one for every axis:
task.loadedMeshes[0]._children[1].scaling.x = 1000;
task.loadedMeshes[0]._children[1].scaling.y = 1000;
task.loadedMeshes[0]._children[1].scaling.z = 1000;

1 Like

That should be:

task.loadedMeshes[0]._children[1].scaling = new BABYLON.Vector3(1000,1000,1000);
2 Likes

You can also use scaling.setAll(1000)

1 Like

I didn’t write new FML yikes

thank you so much; sorry about that

1 Like