Create the scene and engine in Babylon.js 2.0

Example of creating the scene and engine in Babylon.js 2.0.
     // Fetch the canvas element from the HTML
        var canvas = document.querySelector("#renderCanvas");

     // Load BABYLON
        var engine = new BABYLON.Engine(canvas, true);
	
// This function will create our world
var createScene = function () {

	 // Creating the BABYLON scene
	    var scene = new BABYLON.Scene(engine);

	 // Change the scenes' background to black
	    scene.clearColor = new BABYLON.Color3(0, 0, 0);
	    
	 // Set the scenes' ambient color to a bit of blue
	    scene.ambientColor = new BABYLON.Color3(0, 0, 0.03);

	return scene;

}	

createScene();

Responses

0 Replies