# Add button in world space

**URL:** <https://forum.babylonjs.com/t/add-button-in-world-space/16292>\
**Category:** Questions\
**Created:** [December 3, 2020, 3:57pm UTC](https://forum.babylonjs.com/t/add-button-in-world-space/16292 "2020-12-03T15:57:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![saifshk17](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/saifshk17/32/1418_2.png) [@saifshk17](https://forum.babylonjs.com/u/saifshk17)\
**Post date:** [December 3, 2020, 3:57pm UTC](https://forum.babylonjs.com/t/add-button-in-world-space/16292/1 "2020-12-03T15:57:07Z")

</div>

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:

```auto
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?

```auto
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);
    }

```

---

<div class="post-metadata">

**Author:** ![kvasss](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kvasss/32/3774_2.png) [@kvasss](https://forum.babylonjs.com/u/kvasss)\
**Post date:** [December 3, 2020, 4:37pm UTC](https://forum.babylonjs.com/t/add-button-in-world-space/16292/2 "2020-12-03T16:37:48Z")

</div>

Hi. Simply add mesh like plane and hide this mesh or try use transformNode [Transform Node | Babylon.js Documentation](https://doc.babylonjs.com/divingDeeper/mesh/transforms/parent_pivot/transform_node) but I don’t know if you can attach gui element to transform node… But you can try.

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [December 4, 2020, 12:05am UTC](https://forum.babylonjs.com/t/add-button-in-world-space/16292/3 "2020-12-04T00:05:05Z")

</div>

> [@saifshk17](#):
>
> Is there a way to create the `AdvancedDynamicTexture` for world space?

I’m not sure what you mean by this. If you are trying to make a 2D button move with a world space coordinate, you can use [linkWithMesh](https://doc.babylonjs.com/typedoc/classes/babylon.gui.button#linkwithmesh) to link it to a transform node. Is this what you mean?
