diff --git a/sim_scenes/featured/look_at_sky_on_earth.py b/sim_scenes/featured/look_at_sky_on_earth.py index 030ea3d16edc10a13e982eab20f96803def1835f..2b430d36b28e571b8852e3e4606ca766dbda78c6 100644 --- a/sim_scenes/featured/look_at_sky_on_earth.py +++ b/sim_scenes/featured/look_at_sky_on_earth.py @@ -6,6 +6,8 @@ # link :https://gitcode.net/pythoncr/ # python_version :3.9 # ============================================================================== +import math + from ursina import camera from bodies import Sun, Earth @@ -40,6 +42,7 @@ class LookAtSkyOnEarth(UniverseSimScenes): self.show_china = show_china self.show_name = show_name self.exit_at_total_days = exit_at_total_days + self.angle = 55 earth_transparent = look_point is not None @@ -63,6 +66,7 @@ class LookAtSkyOnEarth(UniverseSimScenes): earth_cn_size_factor=earth_cn_size_factor, earth_clouds_size_factor=earth_clouds_size_factor) self.earth.set_resolution(200) + self.earth.set_light_disable(True) # # 地球立春的位置和速度 # self.earth.init_position = [-9.1507536e+07, 0.0000000e+00, 1.1907757e+08] @@ -96,26 +100,38 @@ class LookAtSkyOnEarth(UniverseSimScenes): from simulators.ursina.ursina_mesh import create_sphere from ursina import Entity, color r = 0.5 - y = 0.4 - x = -0.26 - watcher_e = Entity(parent=self.earth.planet, - model=create_sphere(r, 32), - scale=0.05, - y=0.0, x=x-0.17, z=pow(pow(r, 2) - pow(x-0.17, 2), 0.5), color=color.green) + scale = 0.05 + # subdivisions = 16 + x_y_angle = math.pi * self.angle / 180 + xr = r * math.cos(x_y_angle) + y = r * math.sin(x_y_angle) + # z = pow(pow(r, 2) - pow(x, 2) - pow(y, 2), 0.5) + x_z_angle = math.pi * 45 / 180 + x = r * math.cos(x_z_angle) + z = r * math.sin(x_z_angle) + watcher_e = Entity(parent=self.earth.planet, + model="sphere", # create_sphere(r, subdivisions), + scale=scale, + y=0.0, x=-x, z=z, color=color.red) + # y=0.0, x=x-0.17, z=pow(pow(r, 2) - pow(x-0.17, 2), 0.5), color=color.green) + x = xr * math.cos(x_z_angle) + z = xr * math.sin(x_z_angle) watcher_n = Entity(parent=self.earth.planet, - model=create_sphere(r, 32), - scale=0.05, - y=y, x=x, z=pow(pow(r, 2) - pow(x, 2) - pow(y, 2), 0.5), color=color.red) + model="sphere", # create_sphere(r, subdivisions), + scale=scale, + y=y, x=-x, z=z, color=color.green) + # y=y, x=x, z=pow(pow(r, 2) - pow(x, 2) - pow(y, 2), 0.5), color=color.red) watcher_s = Entity(parent=self.earth.planet, - model=create_sphere(r, 32), - scale=0.05, - y=-y, x=x, z=pow(pow(r, 2) - pow(x, 2) - pow(y, 2), 0.5), color=color.blue) + model="sphere", # create_sphere(r, subdivisions), + scale=scale, + y=-y, x=-x, z=z, color=color.blue) + # y=-y, x=x, z=pow(pow(r, 2) - pow(x, 2) - pow(y, 2), 0.5), color=color.blue) def on_ready(self): self.earth.planet.rotation_y -= 180 # 一开始就正对太阳 - # self.earth.planet.alpha = 0.2 + self.earth.planet.alpha = 0.8 # self.earth_cn.planet.rotation_y -= 185 # 一开始就正对太阳 if hasattr(self.earth_clouds, "planet"): self.earth_clouds.planet.rotation_y -= 50 # 一开始就正对太阳 @@ -175,7 +191,7 @@ class LookAtSkyOnEarth(UniverseSimScenes): # if self.look_point == 1: if self.look_point is not None: - camera.rotation_x = 50 * self.look_point + camera.rotation_x = self.angle * self.look_point # camera.rotation_x = 50 # 1 南半球 # if self.look_at_earth: if self.look_point is None: @@ -209,7 +225,7 @@ class LookAtSkyOnEarth(UniverseSimScenes): self.create_sky_watchers() def on_timer_changed(self, time_data: TimeData): - if abs(self.earth.planet.init_rotation_y - self.earth.planet.rotation_y) > 365: + if abs(self.earth.planet.init_rotation_y - self.earth.planet.rotation_y) > 380: exit(0) # if self.show_china and self.wait_days_count > 0: # self.wait_days_count = self.wait_days - time_data.total_days @@ -261,4 +277,4 @@ if __name__ == '__main__': """ # -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator sim = LookAtSkyOnEarth() - sim.run() + sim.run(speed_factor=0.9) diff --git a/sim_scenes/featured/look_at_sky_on_earth_e.py b/sim_scenes/featured/look_at_sky_on_earth_e.py index 277c0e69494ca62a9dbd77226d7e829df97f3fc8..8c1fc3562d9e6833d3ba912bd74d0d285feb1fff 100644 --- a/sim_scenes/featured/look_at_sky_on_earth_e.py +++ b/sim_scenes/featured/look_at_sky_on_earth_e.py @@ -15,4 +15,4 @@ if __name__ == '__main__': """ # -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator sim = LookAtSkyOnEarth(look_point=0) - sim.run() + sim.run(speed_factor=0.85) diff --git a/sim_scenes/featured/look_at_sky_on_earth_n.py b/sim_scenes/featured/look_at_sky_on_earth_n.py index 5302fbb5093f009c0b5cb9b0995fe67a9adf0315..a544de90fd8b1dd6114214a97b3effd23c482e0b 100644 --- a/sim_scenes/featured/look_at_sky_on_earth_n.py +++ b/sim_scenes/featured/look_at_sky_on_earth_n.py @@ -15,4 +15,4 @@ if __name__ == '__main__': """ # -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator sim = LookAtSkyOnEarth(look_point=-1) - sim.run() + sim.run(speed_factor=0.85) diff --git a/sim_scenes/featured/look_at_sky_on_earth_s.py b/sim_scenes/featured/look_at_sky_on_earth_s.py index a1a77a5f19512db1cdadaf41158aceb329207c55..49ce7ce65917d2d4cc80149352ae9b601e4d23e7 100644 --- a/sim_scenes/featured/look_at_sky_on_earth_s.py +++ b/sim_scenes/featured/look_at_sky_on_earth_s.py @@ -15,4 +15,4 @@ if __name__ == '__main__': """ # -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator sim = LookAtSkyOnEarth(look_point=1) - sim.run() + sim.run(speed_factor=0.85)