My script basically imports a glTF file, and allows the user to inspect it, however, I also want all the morph targets on my file to automatically have sliders be made for them on my web page, how can i do that?
Here is my current JS:
var canvas = document.getElementById("renderCanvas");
var engine = new BABYLON.Engine(canvas, true);
var camera;
var createScene = function () {
var scene = new BABYLON.Scene(engine);
// Adjust camera position and target
camera = new BABYLON.ArcRotateCamera("camera", -Math.PI/2, Math.PI/2, 12, new BABYLON.Vector3(0, 3.5, 0), scene);
// Disable camera controls by default
camera.detachControl(canvas);
var light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0), scene);
BABYLON.SceneLoader.ImportMesh("", "./models/", "emoti.glb", scene, function (newMeshes) {
var model = newMeshes[0];
model.scaling = new BABYLON.Vector3(0.5, 0.5, 0.5);
});
return scene;
}
var scene = createScene();
scene.clearColor = new BABYLON.Color4(0, 0, 0, 0.0);
engine.runRenderLoop(function () {
scene.render();
});
window.addEventListener("resize", function () {
engine.resize();
});
// Disable or enable camera controls based on checkbox state
var checkbox = document.getElementById("disableControlsCheckbox");
checkbox.addEventListener("change", function() {
if (checkbox.checked) {
camera.detachControl(canvas);
} else {
camera.attachControl(canvas, true);
}
});
And my model can be found here