About mesh scaling

Hi all…

I was working in PG, i did some thing but i have problems.

Here my PG link: Babylon.js Playground

can help me?

Difficult to help if we don’t know what your intention is and what the problem is.

This PG https://www.babylonjs-playground.com/#A412E1#1 scales the box and since the ground has no depth the ground only scales in x direction. Presume the .x on your line 164 should be .y

I’m trying to do changing mesh sizes with the scroll bars.

Are there any problems with the PG I posted?

Can you check my new PG from here: https://www.babylonjs-playground.com/#A412E1#3
When i maked uncommend line 162 and 170 it not work well.
When i select any mesh i have to handle scaling x and y.
And the second thing is when the scroll values changed I want to make re-size the mesh.

I may be wrong but I think you may be mixing up actual size with scaling.

Created width 2, scaling value 150 width now 300.

In this PG I store the created width of the mesh as a property of the mesh, ie sphere.width = 2 and then multiply this by the scaling value from the slider to set the current width https://www.babylonjs-playground.com/#A412E1#4

Is this closer to what you want?

Thanks for your reply. Actually i want to change mesh width and height with scroll bars… Thats all…

So does the PG I posted https://www.babylonjs-playground.com/#A412E1#4 solve your problem? If not why is it not what you need?

1 Like

I’ll try that in my project and than i will write result to here. Thank you…

1 Like

It’s creating error code on line "headerScaX.text = “Yanal Boyut: " + pickInfo.pickedMesh.width.toFixed();”
On the pg working vell but when i try on the local it’s creating error code.
Error code is: TypeError: pickInfo.pickedMesh.width is undefined.

width is NOT an existing property of a mesh. Look at my playground I have added width and height as properties of sphere and ground on lines 23, 24 and 31 32.

You can use the geometry calculations to assign them (immediately after creation/loading) if you wish or if you do not know the actual created width of the mesh.

sphere.width = sphere.geometry.extend.maximum.x - sphere.geometry.extend.minimum.x;

This width value must always be constant and equal to the created width of the mesh.

1 Like

Thanks for support. I solved my problem and i learned something more…
Babylon is amaizing… :sparkling_heart:

1 Like