How to create your first Scene in Playground
We will create our scenes, save and share them on playground.
BabylonJS Code
To create a basic BabylonJS scene, we initialize a scene, create camera, light and a mesh and return the scene object.
const createScene = () => {
const scene = new BABYLON.Scene(engine);
const camera = new BABYLON.ArcRotateCamera("camera", -Math.PI / 2, Math.PI / 2.5, 3, new BABYLON.Vector3(0, 0, 0));
const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0));
const box = BABYLON.MeshBuilder.CreateBox("box", {});
return scene;
}
Last updated
Was this helpful?