Mrm2299

Untitled

Apr 12th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. //////////////////////////////////////////
  2. //SISTEMA SOLAR POR MANUEL PATIÑO LOPEZ//
  3. /////////////////////// //
  4. //REVISION 2/4/16//
  5. ///////////////////
  6.  
  7.  
  8.  
  9. //INICIO DEL PROGRAMA
  10.  
  11. var createScene = function() {
  12. var scene = new BABYLON.Scene(engine);
  13.  
  14.  
  15.  
  16. //CAMARAS
  17.  
  18. var camara = new BABYLON.FreeCamera("FreeCamera", new BABYLON.Vector3(110, 111, -115), scene);
  19. camara.speed=50
  20. camara.attachControl(canvas, false);
  21.  
  22.  
  23.  
  24. //LUCES
  25.  
  26. var luzsol = new BABYLON.PointLight("Omni1", new BABYLON.Vector3(0, -10, 0), scene);
  27.  
  28.  
  29.  
  30. //VARIABLES DE PLANETAS TAMAÑOS, ETC
  31.  
  32. var sol = BABYLON.Mesh.CreateSphere('sphere1', 16, 200, scene); //POR FINES DIDACTICOS TOMAMOS EL RADIO DEL SOL A 200
  33. var mercurio = BABYLON.Mesh.CreateSphere('sphere1', 16, 2.4, scene);//POR FINES DIDACTICOS LA ESCALA SERA RADIO/1000
  34. var venus = BABYLON.Mesh.CreateSphere('sphere1', 6, 6, scene);
  35. var tierra = BABYLON.Mesh.CreateSphere('sphere1', 6, 6.37, scene);
  36. var marte = BABYLON.Mesh.CreateSphere('sphere1', 6, 3.39, scene);
  37. var jupiter = BABYLON.Mesh.CreateSphere('sphere1', 6, 71.4, scene);
  38. var saturno = BABYLON.Mesh.CreateSphere('sphere1', 6, 60.26, scene);
  39. var urano= BABYLON.Mesh.CreateSphere('sphere1', 6, 25.5, scene);
  40. var neptuno = BABYLON.Mesh.CreateSphere('sphere1', 6, 24.7, scene);
  41.  
  42.  
  43.  
  44. // TEXTURAS?¿ Y MATERIALES
  45. var material = new BABYLON.StandardMaterial("kosh", scene);
  46. sol.material = new BABYLON.StandardMaterial("luces", scene);
  47. sol.material.diffuseColor = new BABYLON.Color3(01, 01, 01);
  48. sol.material.specularColor = new BABYLON.Color3(01, 01, 01);
  49. sol.material.emissiveColor = new BABYLON.Color3(01, 1, 01);
  50.  
  51.  
  52.  
  53.  
  54. //Posicion inicial del sol
  55.  
  56. //sol.position.x = 0
  57. //sol.position.y = 6.5
  58.  
  59.  
  60.  
  61. // Animacion MERCURIO
  62.  
  63. var alpha = 0;
  64. scene.registerBeforeRender(function () {
  65. mercurio.rotation.x += 0.01;
  66. mercurio.rotation.z += 0.02;
  67. mercurio.position = new BABYLON.Vector3(Math.cos(alpha) *257, 10, Math.sin(alpha) * 257);
  68. alpha += 0.001087 //ALREDEDOR DE 87 DIAS TERRESTRES
  69. });
  70.  
  71.  
  72.  
  73. //Animacion VENUS
  74.  
  75. var beta = 0;
  76. scene.registerBeforeRender(function () {
  77. venus.rotation.x += 0.01;
  78. venus.rotation.z += 0.02;
  79. venus.position = new BABYLON.Vector3(Math.cos(beta) *308, 10, Math.sin(beta) * 308);
  80. beta += 0.0010254 ;//ALREDEDOR DE 254 DIAS TERRESTRES
  81. });
  82.  
  83.  
  84.  
  85. //Animacion TIERRA
  86.  
  87. var gamma = 0;
  88. scene.registerBeforeRender(function () {
  89. tierra.rotation.x += 0.01;
  90. tierra.rotation.z += 0.02;
  91. tierra.position = new BABYLON.Vector3(Math.cos(gamma) *349, 10, Math.sin(gamma) * 349);
  92. gamma += 0.00100365//ALREDEDOR DE 365 DIAS
  93. });
  94.  
  95.  
  96.  
  97. //Animacion MARTE
  98.  
  99. var delta = 0;
  100. marte.registerBeforeRender(function () {
  101. marte.rotation.x += 0.01;
  102. marte.rotation.z += 0.02;
  103. marte.position = new BABYLON.Vector3(Math.cos(delta) *427, 10, Math.sin(delta) * 427);
  104. delta += 0.00100686;//ALREDEDOR DE 686 DIAS
  105. });
  106.  
  107.  
  108.  
  109. //Animacion JUPITER
  110.  
  111. var epsilon = 0;
  112. scene.registerBeforeRender(function () {
  113. jupiter.rotation.x += 0.01;
  114. jupiter.rotation.z += 0.02;
  115. jupiter.position = new BABYLON.Vector3(Math.cos(epsilon) *998, 10, Math.sin(epsilon) * 998);
  116. epsilon += 0.00001004015;// ALREDEDOR DE 4015 DIAS
  117. });
  118.  
  119.  
  120.  
  121. //Animacion SATURNO
  122.  
  123. var dseta = 0;
  124. scene.registerBeforeRender(function () {
  125. saturno.rotation.x += 0.01;
  126. saturno.rotation.z += 0.02;
  127. saturno.position = new BABYLON.Vector3(Math.cos(dseta) *1629, 10, Math.sin(dseta) * 1629);
  128. dseta += 0.000010010585// ALREDEDOR DE 10585
  129. });
  130.  
  131.  
  132.  
  133. //Animacion URANO
  134.  
  135. var eta = 0;
  136. scene.registerBeforeRender(function () {
  137. urano.rotation.x += 0.01;
  138. urano.rotation.z += 0.02;
  139. urano.position = new BABYLON.Vector3(Math.cos(eta) *3070, 10, Math.sin(eta) * 3070);
  140. eta += 0.000010030660// ALREDEDOR DE 30660 DIAS
  141. });
  142.  
  143.  
  144.  
  145. //Animacion NEPTUNO
  146.  
  147. var iota = 0;
  148. scene.registerBeforeRender(function () {
  149. neptuno.rotation.x += 0.01;
  150. neptuno.rotation.z += 0.02;
  151. neptuno.position = new BABYLON.Vector3(Math.cos(iota) *4704, 10, Math.sin(iota) * 4704);
  152. iota += 0.000010059860;// ALREDEDOR DE 59860 DIAS
  153. });
  154.  
  155.  
  156.  
  157. //PLUTON NO EXISTE
  158.  
  159.  
  160.  
  161. return scene;
  162. };
Advertisement
Add Comment
Please, Sign In to add comment