Borjan

GUI.Control isVisible does not work if linked with a mesh

Recommended Posts

Hiding and showing controls by using isVisible (like a Rectangle in this case) works if the control is not linked to a mesh by linkWithMesh.

Once it is attached, the control stays visible. The inner controls (in my case the text inside the rectangle) can be hidden.

See the playground https://www.babylonjs-playground.com/index.html#RBP60B#6 lines 35-42.

Share this post


Link to post
Share on other sites

In advancedDynamicTexture.ts or  the whole  js file

Around line 205. You can add. Maybe I'm wrong. It seems to fix the pb.

 if (projectedPosition.z < 0 || projectedPosition.z > 1 ) {
     control.isVisible = false;
     continue;
 }

// add this above the first if
 if (!control.isVisible) {                        
  continue;
 }

 

Share this post


Link to post
Share on other sites
10 hours ago, Samuel Girardin said:

In advancedDynamicTexture.ts or  the whole  js file

Around line 205. You can add. Maybe I'm wrong. It seems to fix the pb.


 if (projectedPosition.z < 0 || projectedPosition.z > 1 ) {
     control.isVisible = false;
     continue;
 }

// add this above the first if
 if (!control.isVisible) {                        
  continue;
 }

 

Thanks Samuel,

looking into your example: https://www.babylonjs-playground.com/#ZI9AK7#21 I've figured out that the hiding in your case works due to the way how you instantiate the texture:

advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateForMesh(plane);

while I do:

advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("ui1");

As I'm really not proficient with 3D programming, I do not understand the difference - will read the documentation one of these days. 

I would prefer not to change the js library - it goes far beyond my knowledge - until 2 weeks ago I've never programmed java script ... For me would be simpler not to use CreateFullscreenUI for the time being and wait till the fix becomes a part of the release.

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.