Jump to content

GUI clears texture


waverider
 Share

Recommended Posts

Hy there, i've been battling with these for hours and i thought i should share, the GUI clears the texture in my scene each time i linked it to more than one model not sure if this is a bug but here's my code:

var createUI = function(obj){
  // GUI
  this.obj = null||obj
    var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");
   var rect1 = new BABYLON.GUI.Rectangle();
    rect1.width = 0.2;
    rect1.height = "20px";
    rect1.cornerRadius = 20;
    rect1.color = "blue";
    rect1.thickness = 4;
    rect1.background = "silver";
    
    advancedTexture.addControl(rect1);

    var label = new BABYLON.GUI.Rectangle();
     label.width = 0.8;
    label.height = "10px";
    label.cornerRadius = 20;
    label.thickness = 2;
    label.background = "green";
    
    rect1.addControl(label);

    rect1.linkWithMesh(this.obj); 
    rect1.linkOffsetY = -50;
    rect1.alpha = 1
	
    return rect1;

}

 

Link to comment
Share on other sites

I changed the scale of my rendering canvas but the pointer coordinate somehow gets messed up. how can i set the pointer coordinate for buttons,  here's my code:

var coord = new BABYLON.Vector2(scene.pointerX/4, scene.pointerY/4).normalize()
  
    button1._onPointerDown = function(button1, coord){
            console.log(coord)
    }

 

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...