Hello everyone
I want to use the dat.GUI()
on my UI for hiding and showing the models, but it doesn’t work.
and here is my code :
if (model){
var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {diameter: 2, segments: 32}, scene);
}
var options = {
camera_x : cameraX,
camera_y : cameraY,
camera_z : cameraZ,
show: model
}
//GUI
var oldgui = document.getElementById("datGUI");
if (oldgui != null) {
oldgui.remove();
}
var gui = new dat.GUI();
gui.domElement.style.marginTop = "100px";
gui.domElement.id = "datGUI";
var camOptions = gui.addFolder('Camera Set Target');
camOptions.add(options, 'camera_x').onChange(function (value) {
camera._currentTarget.x = value;
});
var models = gui.addFolder("Show Models");
models.add(options, "show").onChange(function (value) {
model = value;
});
here is my PG : https://playground.babylonjs.com/#3RLG7P#1