Hello,
Is there a way to create the AdvancedDynamicTexture
for world space? I am trying to add a button in a scene and the only way I came across online for a world space is to define it as such:
var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateForMesh(mesh);
But what if my scene does not have a mesh. So is there a way to add a button to the scene and I can move with position node?
var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateForMesh(meshName);
var panel = new BABYLON.GUI.StackPanel();
panel.isVertical = false;
panel.verticalAlignment = BABYLON.GUI.Control.VERTICAL_ALIGNMENT_BOTTOM;
advancedTexture.addControl(panel);
var addButton = function (text, callback) {
var button = BABYLON.GUI.Button.CreateSimpleButton("button", text);
button.width = "140px";
button.height = "40px";
button.color = "white";
button.background = "green";
button.paddingLeft = "10px";
button.paddingRight = "10px";
button.onPointerUpObservable.add(function () {
callback();
});
panel.addControl(button);
}