Skip to content

Instantly share code, notes, and snippets.

@deltakosh
Created March 6, 2023 22:51
Show Gist options
  • Save deltakosh/53f9f2125c5c0ae7a918087db0028845 to your computer and use it in GitHub Desktop.
Save deltakosh/53f9f2125c5c0ae7a918087db0028845 to your computer and use it in GitHub Desktop.
var createScene = async function () {
var scene = new BABYLON.Scene(engine);
// Let's create our potato
var potato = BABYLON.MeshBuilder.CreateSphere("potato",
{ diameterX: 0.8, diameterY: 0.9, diameterZ: 0.8 },
scene);
// Create a potato(ish) material
var matCap = await BABYLON.NodeMaterial.ParseFromSnippetAsync("WSJ3VZ")
potato.material = matCap;
potato.isPickable = true;
potato.enablePointerMoveEvents = true;
// Environment
scene.createDefaultCamera(true, true, true);
scene.createDefaultEnvironment({
enableGroundMirror: true,
createSkybox: false,
});
// Prevent camera from going below the ground
scene.activeCamera.upperBetaLimit = 1.5;
return scene;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment