Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // You have to create a function called createScene. This function must return a BABYLON.Scene object
- // You can reference the following variables: scene, canvas
- // You must at least define a camera
- // More info here: https://github.com/BabylonJS/Babylon.js/wiki/The-Playground
- var createScene = function() {
- var scene = new BABYLON.Scene(engine);
- var camera = new BABYLON.ArcRotateCamera("Camera", 0, Math.PI / 2, 12, BABYLON.Vector3.Zero(), scene);
- camera.attachControl(canvas, false);
- //Luces
- var light0 = new BABYLON.PointLight("Omni0", new BABYLON.Vector3(0, 0, 0), scene);
- light0.diffuse = new BABYLON.Color3(1, 01, 01);
- light0.specular = new BABYLON.Color3(1, 1, 1);
- var light0 = new BABYLON.HemisphericLight("Hemi0", new BABYLON.Vector3(0, 1, 0), scene);
- // Variables planetas
- var sol = BABYLON.Mesh.CreateSphere('sphere1', 16, 52, scene);
- var mercurio = BABYLON.Mesh.CreateSphere('sphere1', 16, 2, scene);
- var venus = BABYLON.Mesh.CreateSphere('sphere1', 6, 5, scene);
- sol.material = new BABYLON.StandardMaterial("texture1", scene);
- sol.material.ambientTexture = new BABYLON.Texture("grass.png", scene);
- // Posiciones iniciales
- sol.position.x = 0
- sol.position.y = 6.5
- // Animacion MERCURIO
- var alpha = 0;
- scene.registerBeforeRender(function () {
- mercurio.rotation.x += 0.01;
- mercurio.rotation.z += 0.02;
- mercurio.position = new BABYLON.Vector3(Math.cos(alpha) *40, 10, Math.sin(alpha) * 40);
- alpha += 0.019;
- });
- //Animacion Venus
- var beta = 0;
- scene.registerBeforeRender(function () {
- venus.rotation.x += 0.01;
- venus.rotation.z += 0.02;
- venus.position = new BABYLON.Vector3(Math.cos(beta) *60, 10, Math.sin(beta) * 60);
- beta += 0.01;
- });
- //Animacion Tierra
- return scene;
- };
Advertisement
Add Comment
Please, Sign In to add comment