Created
March 6, 2023 22:51
-
-
Save deltakosh/53f9f2125c5c0ae7a918087db0028845 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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