About a month ago I created my first babylon project. I exported a glb model from 3ds Max, imported it to sandbox, added a few changes, exported it to *.babylon file and wrote some code. Now I exported my second model, basically copied my old code and just changed the scene to be loaded. When I open it in a browser (Chrome) I can’t move the camera. Everything else seems to work correctly (materials, particle systems, etc.). I also tried to reuse my code with the old model I created and the problem didn’t occur. I think it is a problem with the exporter, since the old model worked correctly.
Here are my export settings:
Here is the code I used:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>MIA - 3D model</title>
<style>
html, body {
overflow: hidden;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#renderCanvas {
width: 100%;
height: 100%;
touch-action: none;
}
</style>
<script src="https://cdn.babylonjs.com/babylon.js"></script>
</head>
<body>
<canvas id="renderCanvas"></canvas>
<script>
const canvas = document.getElementById("renderCanvas"); // Get the canvas element
const engine = new BABYLON.Engine(canvas, true); // Generate the BABYLON 3D engine
const createScene = function () {
// This creates a basic Babylon Scene object (non-mesh)
var scene = new BABYLON.Scene(engine);
var camera = new BABYLON.ArcRotateCamera("Camera", 2.36, 1.2, 4.89, new BABYLON.Vector3(0, 1, 0), scene);
//var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);
camera.attachControl(canvas, true);
camera.wheelPrecision = 1000;
camera.upperRadiusLimit = 10;
camera.lowerRadiusLimit = 0;
camera.minZ = 0.01;
camera.panningSensibility = 10000;
camera.inertia = 0.7;
//camera.cameraAcceleration = 0.005;
//camera.maxCameraSpeed = 1;
camera.pinchDeltaPrecentage = 0.001;
camera.wheelDeltaPercentage = 0.001;
camera.useFramingBehavior = true;
camera.nearPlane = 0.1;
var inputManager = camera.inputs;
// Mousewheel
if (camera.inputs.attached['mousewheel'])
{
camera.inputs.attached.mousewheel.wheelDeltaPercentage = 0; // default: 0
camera.inputs.attached.mousewheel.wheelPrecision = 30; // default: 3
}
// Pointers
if (camera.inputs.attached['pointers'])
{
camera.inputs.attached.pointers.angularSensibilityX = 1000; // default: 1 (higher is slower)
camera.inputs.attached.pointers.angularSensibilityY = 1000; // default: 1 (higher is slower)
camera.inputs.attached.pointers.pinchDeltaPercentage = 0.001; // default: 0
camera.inputs.attached.pointers.pinchPrecision = 10000;
}
BABYLON.SceneLoader.Append("", "scene_04.babylon", scene, (loadedScene) => {
})
return scene;
};
const scene = createScene(); //Call the createScene function
// Register a render loop to repeatedly render the scene
engine.runRenderLoop(function () {
scene.render();
});
// Watch for browser/canvas resize events
window.addEventListener("resize", function () {
engine.resize();
});
</script>
</body>
</html>