Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////////////
- //SISTEMA SOLAR POR MANUEL PATIÑO LOPEZ//
- /////////////////////// //
- //REVISION 2/4/16//
- ///////////////////
- //INICIO DEL PROGRAMA
- 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 DE PLANETAS TAMAÑOS, ETC
- var sol = BABYLON.Mesh.CreateSphere('sphere1', 16, 200, scene); //POR FINES DIDACTICOS TOMAMOS EL RADIO DEL SOL A 200
- var mercurio = BABYLON.Mesh.CreateSphere('sphere1', 16, 2.4, scene);//POR FINES DIDACTICOS LA ESCALA SERA RADIO/1000
- var venus = BABYLON.Mesh.CreateSphere('sphere1', 6, 6, scene);
- var tierra = BABYLON.Mesh.CreateSphere('sphere1', 6, 6.37, scene);
- var marte = BABYLON.Mesh.CreateSphere('sphere1', 6, 3.39, scene);
- var jupiter = BABYLON.Mesh.CreateSphere('sphere1', 6, 71.4, scene);
- var saturno = BABYLON.Mesh.CreateSphere('sphere1', 6, 60.26, scene);
- var urano= BABYLON.Mesh.CreateSphere('sphere1', 6, 25.5, scene);
- var neptuno = BABYLON.Mesh.CreateSphere('sphere1', 6, 24.7, scene);
- // TEXTURAS?¿
- 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) *257, 10, Math.sin(alpha) * 257);
- alpha += 0.01605479452 //ALREDEDOR DE 87 DIAS TERRESTRES
- });
- //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) *308, 10, Math.sin(beta) * 308);
- beta += 0.06136986301 ;//ALREDEDOR DE 254 DIAS TERRESTRES
- });
- //Animacion TIERRA
- var gamma = 0;
- scene.registerBeforeRender(function () {
- tierra.rotation.x += 0.01;
- tierra.rotation.z += 0.02;
- tierra.position = new BABYLON.Vector3(Math.cos(gamma) *349, 10, Math.sin(gamma) * 349);
- gamma += 0.0001;//ALREDEDOR DE 365 DIAS
- });
- //Animacion MARTE
- var delta = 0;
- marte.registerBeforeRender(function () {
- marte.rotation.x += 0.01;
- marte.rotation.z += 0.02;
- marte.position = new BABYLON.Vector3(Math.cos(delta) *427, 10, Math.sin(delta) * 427);
- delta += 0.000686;//ALREDEDOR DE 686 DIAS
- });
- //Animacion JUPITER
- var epsilon = 0;
- scene.registerBeforeRender(function () {
- jupiter.rotation.x += 0.01;
- jupiter.rotation.z += 0.02;
- jupiter.position = new BABYLON.Vector3(Math.cos(epsilon) *998, 10, Math.sin(epsilon) * 998);
- epsilon += 0.004379;// ALREDEDOR DE 4379 DIAS
- });
- //Animacion SATURNO
- var dseta = 0;
- scene.registerBeforeRender(function () {
- saturno.rotation.x += 0.01;
- saturno.rotation.z += 0.02;
- saturno.position = new BABYLON.Vector3(Math.cos(dseta) *1629, 10, Math.sin(dseta) * 1629);
- dseta += 0.0010585;// ALREDEDOR DE 10585 DIAS
- });
- //Animacion URANO
- var eta = 0;
- scene.registerBeforeRender(function () {
- urano.rotation.x += 0.01;
- urano.rotation.z += 0.02;
- urano.position = new BABYLON.Vector3(Math.cos(eta) *3070, 10, Math.sin(eta) * 3070);
- eta += 0.0010585;// ALREDEDOR DE 10585 DIAS
- });
- //Animacion NEPTUNO
- var dseta = 1110;
- scene.registerBeforeRender(function () {
- neptuno.rotation.x += 0.01;
- neptuno.rotation.z += 0.02;
- neptuno.position = new BABYLON.Vector3(Math.cos(dseta) *4704, 10, Math.sin(dseta) * 4704);
- dseta += 0.0010585;// ALREDEDOR DE 10585 DIAS
- });
- //PLUTON NO EXISTE
- return scene;
- };
Add Comment
Please, Sign In to add comment