// Get the Canvas element from our HTML below
var canvas = document.getElementById("renderCanvas");
// Load BABYLON 3D engine
var engine = new BABYLON.Engine(canvas, true);
window.scene = new BABYLON.Scene(engine);
var scene = window.scene;
// Creating a camera looking to the zero point (0,0,0), a light, and a sphere of size 1
var camera = new BABYLON.ArcRotateCamera("Camera", 1, 0.8, 30, new BABYLON.Vector3(0, 0, 0), scene);
var light0 = new BABYLON.PointLight("Omni", new BABYLON.Vector3(0, 0, 10), scene);
var material = new BABYLON.StandardMaterial("material01", scene);
material.emissiveColor = new BABYLON.Color3(0, 1, 0);
var material2 = new BABYLON.StandardMaterial("material02", scene);
material2.emissiveColor = new BABYLON.Color3(1, 0, 0);
var cube2 = BABYLON.Mesh.CreateBox("Box2", 2, scene);
cube2.position.x = 0.0;
cube2.position.y = 4;
cube2.position.z = 4;
cube2.material = material2
var cube = BABYLON.Mesh.CreateBox("Box", 2, scene);
cube.position.x = 0.0;
cube.position.y = 3.0;
cube.position.z = 3.0;
cube.material = material;
cube.parent = cube2;
// Attach the camera to the scene
scene.activeCamera.attachControl(canvas);
// Once the scene is loaded, just register a render loop to render it
engine.runRenderLoop(function () {
scene.render();
});
jQuery('#dispose').click(function() {
cube2.dispose(true);
console.log("meshes:", scene.meshes);
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.