Dynamic height of plane/advanced dynamic texture based on text lenght

Hey, Im trying to create plane where the text on the plane is defined by a user input (text). The width of the plane/ADT is fixed but the height should be calculated based on the length of the user input. Here is a playground with what i have made so far: https://playground.babylonjs.com/#XTYXH3#1 . If you have any good ideas/input for how this could be achieved, its very much appriated. Thank you :slight_smile:

Hi there. Let’s see what I can do for you :slight_smile:

https://playground.babylonjs.com/#XTYXH3#3

I got you! Now one thing to note is you will want to also play with the render scale to scale the texture to the new size of the plane. But you can adjust based on what youd like the defaults to be.

Fun fact this is how I do it in the upcoming GUI editor :wink:

thanks for the quick response :slight_smile: In your PG its only possible to have a single line and the font becomes stretched. In my case i need multiple lines so i dont think an inputText gui element is the right thing here?

You just add multiple lines or just using textBlock. Full list of controls can be found here:

The stretch comes from the render scale. The advance texture is being mapped onto a stretching mesh so you’ll need to calculate any updates.