UV mapping AdvancedDynamicTexture on Plane?

I am trying to make these planes with dynamic text on it which I can scatter around in my scene as labels on different objects.


My problem is that I don’t understand how I can make the AdvancedDynamicTexture behave, so I can properly align the text on the plane, and not let it get squished in the height/width if the plane is not exactly rectangular.

Maybe I am going about this in the completely wrong way, I am not sure, but I really like the power of the easy runtime modification of the TextBlock element.

Hello and welcome!!
The idea is to adapt your texture to the ratio of your plane:


Thank you!

It didn’t occur to me to look there. After your answer, the alignment properties now works natural with:

text.textHorizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
text.textVerticalAlignment = BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP;

1 Like