Babylonjs自定义按钮

时间:2018-08-15 02:33:06

标签: babylonjs

我开始使用Babylonjs(0.00001级)。我想为每个在网站上打开不同页面的按钮自定义按钮,并使用不同的图像。

我在巴比伦游乐场获得了这个例子:

var createScene = function () {
    var scene = new BABYLON.Scene(engine);
    var camera = new BABYLON.ArcRotateCamera("cam", -Math.PI / 2, Math.PI / 2, 10, BABYLON.Vector3.Zero());
    var anchor = new BABYLON.TransformNode("");

    camera.wheelDeltaPercentage = 0.01;
    camera.attachControl(canvas, true);

    // Create the 3D UI manager
    var manager = new BABYLON.GUI.GUI3DManager(scene);

    var panel = new BABYLON.GUI.SpherePanel();
    panel.margin = 0.2;

    manager.addControl(panel);
    panel.linkToTransformNode(anchor);
    panel.position.z = -1.5;

    // Let's add some buttons! 
    var addButton = function() {
        var button = new BABYLON.GUI.HolographicButton("orientation");
        panel.addControl(button);

        button.text = "Button #" + panel.children.length;
    }

    panel.blockLayout = true;
    for (var index = 0; index < 60; index++) {
        addButton();    
    }
    panel.blockLayout = false;

    return scene;

};

但是我不知道该怎么做。你能帮我吗?

0 个答案:

没有答案