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);
- //CAMARAS
- var camara = new BABYLON.FreeCamera("FreeCamera", new BABYLON.Vector3(110, 111, -115), scene);
- camara.speed=50
- camara.attachControl(canvas, false);
- //LUCES
- var luzsol = new BABYLON.PointLight("Omni1", new BABYLON.Vector3(0, 0, 0), scene);
- var luzespacio = new BABYLON.HemisphericLight("Hemi0", new BABYLON.Vector3(0, 1, 0), scene);
- luzespacio.intensity = 0.2
- luzsol.intensity = 0.9
- //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?¿ Y MATERIALES
- //SOL
- var material = new BABYLON.StandardMaterial("materialsol", scene);
- sol.material = new BABYLON.StandardMaterial("luz", scene);
- sol.material.diffuseColor = new BABYLON.Color3(01, 01, 01);
- sol.material.specularColor = new BABYLON.Color3(01, 01, 01);
- sol.material.emissiveColor = new BABYLON.Color3(01, 1, 01);
- sol.material.ambientTexture = new BABYLON.Texture("sun.png", scene);
- //MERCURIO
- var material = new BABYLON.StandardMaterial("materialmercurio", scene);
- mercurio.material = material;
- material.diffuseTexture = new BABYLON.Texture("mercurio.png", scene);
- //Posicion inicial del sol
- //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.001087 //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.0010254 ;//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.00100365//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.00100686;//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.00001004015;// ALREDEDOR DE 4015 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.000010010585// ALREDEDOR DE 10585
- });
- //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.000010030660// ALREDEDOR DE 30660 DIAS
- });
- //Animacion NEPTUNO
- var iota = 0;
- scene.registerBeforeRender(function () {
- neptuno.rotation.x += 0.01;
- neptuno.rotation.z += 0.02;
- neptuno.position = new BABYLON.Vector3(Math.cos(iota) *4704, 10, Math.sin(iota) * 4704);
- iota += 0.000010059860;// ALREDEDOR DE 59860 DIAS
- });
- //PLUTON NO EXISTE
- return scene;
- };
Advertisement
Add Comment
Please, Sign In to add comment