How to scale 3d Buttons on Plane Panel, StackPanel etc

I am trying to use button.scaling but it doesn’t do anything.

If i scale the button.node.scaling this has an odd affect and squishes the content, i try to set the content scale ratio and this doesn’t add much.

I am obviously doing somethign very wrong.

Any help is appreciated

https://www.babylonjs-playground.com/#HJZBRG#29

I know this is a bit weird but you need to add the control to the panel before changing anything:
https://www.babylonjs-playground.com/#HJZBRG#30

Thanks for the response.

This does appear the change the scale but then the content seems stretched? Is that sorted out by some value on contentScaleRatio?

Yep totally:)

Here ive set the button scaling on the Y to 0.2, and then the contentScaleRatio should be set to 0.8?

I’ve tried but still looks stretched.

https://www.babylonjs-playground.com/#HJZBRG#32

oh yep unfortunately the scale is on all directions so this will not help.

So here you should actually leverage text.scaleY:https://www.babylonjs-playground.com/#HJZBRG#36

2 Likes

Thanks for the help, that has worked! I will suppose this would be the same for images inside buttons and so forth.

correct

1 Like