I have a UI card that I’d like to be able to scale with a gizmo. The card setup is as follows
- Card - a box mesh - the parent object for the card
- Plane - a plane placed just off the surface of the box
- Advanced Dynamic Texture drawn on the surface of the plane
- GUI content - in this case, just a grid with some placeholder rects.
I added a BoundingBoxGizmo
gizmo to the card so I can scale it. This works but it is easy to scale the card in a way that breaks the aspect ratio of the texture/GUI. I added onScaleBoxDragEndObservable
to adjust the texture after the card is scaled, but this is where I’m running into issues.
It seems like I need to use advancedTexture.scaleTo()
with new width and height values, but when I use method this the texture disappears.
It seems like anytime I call scaleTo()
after the initial time that the scene has started to a plane, it ends up disappearing on me.
Here is a playground. The card is setup as described above. A timeout of 3 seconds will try to call scaleTo()
which will cause the texture to disappear. You can disable line 99 to remove this timeout. Using the scale gizmo on the card will also trigger the issue.
Is it possible to adjust the scale or aspect ratio of Advanced Dynamic Texture while a scene is running? Am I using the wrong method or using scaleTo()
incorrectly?