<canvas id="renderCanvas"></canvas>
<script src="https://preview.babylonjs.com/babylon.js"></script>
<script src="https://code.jquery.com/pep/0.4.1/pep.js"></script>
html, body {
width: 100%;
height: 100%;
overflow: hidden;
}
#renderCanvas {
width : 100%;
height : 100%;
touch-action: none;
}
function main() {
const canvas = document.getElementById('renderCanvas');
const engine = new BABYLON.Engine(canvas);
const createScene = () => {
const scene = new BABYLON.Scene(engine);
//Create large ground for valley environment
const largeGround = BABYLON.MeshBuilder.CreateGroundFromHeightMap("largeGround", "https://assets.babylonjs.com/environments/villageheightmap.png", {width:150, height:150, subdivisions: 20, minHeight:0, maxHeight: 10});
/**** Set camera and light *****/
const camera = new BABYLON.ArcRotateCamera("camera", -Math.PI / 2, Math.PI / 2.5, 200, new BABYLON.Vector3(0, 0, 0));
camera.attachControl(canvas, true);
const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(4, 1, 0));
return scene;
}
const scene = createScene();
engine.runRenderLoop(() => {
scene.render();
});
window.addEventListener('resize', () => {
engine.resize();
});
}
window.addEventListener('DOMContentLoaded', main);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.