Jump to content

Stop stretching on AdvancedDynamicTexture mesh


joshcamas
 Share

Recommended Posts

Hello friends :)

When attaching to a mesh, babylon's GUI scale and ratio is dependent on the mesh's ratio. This is fine, unless you have a dynamic GUI in which you don't know the exact ratio of the GUI you'll be building. This causes issues:
https://www.babylonjs-playground.com/#0U0RKU#2

My idea is to dynamically scale the mesh after the GUI is finished - by defining either the width or the height of the mesh, and then calculate the corresponding height or width depending on the GUI's aspect ratio.

Problem is, I can't seem to find this aspect ratio. I've tried grabbing the dimensions of the root container, but they return 0. Also, the AdvancedDynamicTexture's resolution is defined before the GUI can be created, thus creating another aspect ratio problem :(

Any thoughts? I feel like I'm missing an obvious solution here xD

Josh

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...