I'm just got to know about babylon.js and started to try it out. I follow this youtube video for beginners. I used CDN for using babylon.js as https://cdn.jsdelivr.net/npm/babylonjs@4.2.0/babylon.js.
This is the program i typed ๐
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
overflow: hidden;
}
canvas {
width: 100%;
height: 100%;
}
</style>
<body>
<canvas id="renderCanvas"></canvas>
<script src="https://cdn.jsdelivr.net/npm/babylonjs@4.2.0/babylon.js"></script>
<script>
const canvas = document.getElementById("renderCanvas");
const engine = BABYLON.Engine(canvas, true);
function createScene() {
const scene = new BABYLON.Scene(engine);
const camera = new BABYLON.FreeCamera('camera', new BABYLON.Vector3(0, 0, 0), scene);
const light = new BABYLON.HemisphericLight('light', new BABYLON.Vector3(0, 1, 0), scene);
return scene;
}
const scene = createScene();
engine.runRenderLoop(()=>{
scene.render();
})
</script>
</body>
</html>
When i run the program this error is shown in the console ๐
Uncaught TypeError: this.resize is not a function
at Module.e (babylon.js:16)
at Module.t (babylon.js:16)
at index.html:29
How should i resolve this issue?