Jump to content

3D GUI - Labels?


joshcamas
 Share

Recommended Posts

Hello friends :)

I can't seem to get labels working in 3D GUI. I can get them attached to a button, but I don't need a button xD I need a label

Is there a way to get a 3d button with just the "content" feature, with no actual button graphic / interaction?

Thanks!
Josh

Link to comment
Share on other sites

I use this to create labels on a mesh:

createLabel(mesh, name = null)
{	
	let labelRectangle["label_"+name] = new BABYLON.GUI.Rectangle("label_"+name);
	labelRectangle["label_"+name].background = "#d52349";
	labelRectangle["label_"+name].height = "14px";
	labelRectangle["label_"+name].alpha = 0.8;
	labelRectangle["label_"+name].width = "100px";
	labelRectangle["label_"+name].cornerRadius = 7;
	labelRectangle["label_"+name].thickness = 1;
	labelRectangle["label_"+name].isVisible = true;
	labelRectangle["label_"+name].adaptWidthToChildren = true;
	this.advancedTextureLabel.addControl(labelRectangle["label_"+name]);
	labelRectangle["label_"+name].linkWithMesh(mesh);

	let textEtiquette = new BABYLON.GUI.TextBlock();
	textEtiquette.text = " "+name+" ";
	labelRectangle["label_"+name].width = (textEtiquette.text.length * 10)+"px";
	textEtiquette.resizeToFit = true;
	textEtiquette.color = "white";
	textEtiquette.fontSize = 13;
	textEtiquette.fontFamily = "Source Sans Pro";
	labelRectangle["label_"+name].addControl(textEtiquette);
}

 

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