Hello,
I want to try to load any .obj file in my playground, I just checked your obj file loader code in my local machine, but did not show any obj file, also it show error
Uncaught Error: No camera defined
please give me proper example or code that will work fine.
i will given the example code but its not working
<title>Babylon.js sample code</title>
<!-- Babylon.js -->
<script src="https://code.jquery.com/pep/0.4.2/pep.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script>
<script src="https://preview.babylonjs.com/ammo.js"></script>
<script src="https://preview.babylonjs.com/cannon.js"></script>
<script src="https://preview.babylonjs.com/Oimo.js"></script>
<script src="https://preview.babylonjs.com/gltf_validator.js"></script>
<script src="https://preview.babylonjs.com/earcut.min.js"></script>
<script src="https://preview.babylonjs.com/babylon.js"></script>
<script src="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js"></script>
<script src="https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script>
<script src="https://preview.babylonjs.com/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js"></script>
<script src="https://preview.babylonjs.com/postProcessesLibrary/babylonjs.postProcess.min.js"></script>
<script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.js"></script>
<script src="https://preview.babylonjs.com/serializers/babylonjs.serializers.min.js"></script>
<script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>
<style>
html, body {
overflow: hidden;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#renderCanvas {
width: 100%;
height: 100%;
touch-action: none;
}
</style>
</head>
var canvas = document.getElementById("renderCanvas");
var delayCreateScene = function () {
var scene = new BABYLON.Scene(engine);
// BABYLON.SceneLoader.ImportMesh("", “scenes/”, “StanfordBunny.obj”, scene, function (meshes) {
// scene.createDefaultCameraOrLight(true, true, true);
// scene.createDefaultEnvironment();
//
// });
BABYLON.SceneLoader.Append("scenes/", "StanfordBunny.obj", scene, function (scene) {
scene.createDefaultCameraOrLight(true, true, true);
scene.createDefaultEnvironment();
});
return scene;
};
var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });
var scene = delayCreateScene();
engine.runRenderLoop(function () {
if (scene) {
scene.render();
}
});
// Resize
window.addEventListener("resize", function () {
engine.resize();
});
</script>
----------------------------------------------------------------------------------------------
please check and give your valuable feedback.
Thanks & regards,
Arnab Mandal