Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
scene.enablePhysics(gravityVector, new CannonJSPlugin);
scene.clearColor = BABYLON.Color4.FromColor3(BABYLON.Color3.Black());
var camera = new BABYLON.FreeCamera("Camera", new BABYLON.Vector3(0, 0, -10), scene);
//var camera = new BABYLON.UniversalCamera("UniversalCamera", new BABYLON.Vector3(0, 0, -10), scene);
camera.checkCollisions = true;
camera.applyGravity = true;
// Targets the camera to a particular position. In this case the scene origin
camera.setTarget(BABYLON.Vector3.Zero());
// Attach the camera to the canvas
camera.attachControl(canvas, true);
var grassMaterial = new BABYLON.StandardMaterial("grass", scene);
var grassTexture = new GrassProceduralTexture("textgrass", 256, scene);
grassMaterial.ambientTexture = grassTexture;
grassMaterial.diffuseTexture= grassTexture;
// Create Ground
var ground = BABYLON.Mesh.CreatePlane("ground", 25.0, scene);
ground.position = new BABYLON.Vector3(0, -5, 0);
ground.rotation = new BABYLON.Vector3(Math.PI / 2, 0, 0);
ground.material = grassMaterial;
// Create the 3D UI manager
var manager = new GUI.GUI3DManager(scene);
// Create a horizontal stack panel
var panel = new GUI.StackPanel3D();
panel.margin = 0.02;
manager.addControl(panel);