提交 75523776 编写于 作者: 三月三net's avatar 三月三net

Python超人-宇宙模拟器

上级 14d1124e
...@@ -92,7 +92,7 @@ class CenterPointMovingSimLive(EarthSeasonsSimBase): ...@@ -92,7 +92,7 @@ class CenterPointMovingSimLive(EarthSeasonsSimBase):
segments=100) segments=100)
# print(points) # print(points)
orbit_line = create_orbit_by_points(center_body.position, points, line_color=body.trail_color, orbit_line = create_orbit_by_points(center_body.position, points, line_color=body.trail_color,
alpha=alpha, thickness=2) alpha=alpha, thickness=4)
return orbit_line return orbit_line
def create_orbit_lines(self): def create_orbit_lines(self):
...@@ -109,7 +109,7 @@ class CenterPointMovingSimLive(EarthSeasonsSimBase): ...@@ -109,7 +109,7 @@ class CenterPointMovingSimLive(EarthSeasonsSimBase):
else: else:
alpha = 0.2 alpha = 0.2
start_time = conv_to_astropy_time(self.start_time) start_time = conv_to_astropy_time(self.start_time)
orbit_line = self.create_orbit_line(self.sun, body, start_time, alpha=1.0) orbit_line = self.create_orbit_line(self.sun, body, start_time, alpha=0.8)
if orbit_line is not None: if orbit_line is not None:
self.orbit_lines.append(orbit_line) self.orbit_lines.append(orbit_line)
return self.orbit_lines return self.orbit_lines
...@@ -173,20 +173,25 @@ class CenterPointMovingSimLive(EarthSeasonsSimBase): ...@@ -173,20 +173,25 @@ class CenterPointMovingSimLive(EarthSeasonsSimBase):
def on_ready(self): def on_ready(self):
super(CenterPointMovingSimLive, self).on_ready() super(CenterPointMovingSimLive, self).on_ready()
self.sky.rotation_y = 20
self.sky.rotation_x = -290
self.sky.rotation_z = -95
UrsinaConfig.trail_type = "line" UrsinaConfig.trail_type = "line"
# UrsinaConfig.trail_length = 91 # UrsinaConfig.trail_length = 91
UrsinaConfig.trail_type = "curve_line" UrsinaConfig.trail_type = "curve_line"
UrsinaConfig.trail_length = 250 UrsinaConfig.trail_length = 180
# UrsinaConfig.trail_length = 1000 # UrsinaConfig.trail_length = 1000
UrsinaConfig.trail_thickness_factor = 2 UrsinaConfig.trail_thickness_factor = 4
UrsinaConfig.trail_factor = 2 UrsinaConfig.trail_alpha = 0.8
UrsinaConfig.trail_factor = 4
for body in self.bodies: for body in self.bodies:
body.planet.trail_scale = 2 body.planet.trail_scale = 0.5
self.moon.planet.trail_scale = 1 self.moon.planet.trail_scale = 0.5
# WorldGrid().draw_axises(10) # WorldGrid().draw_axises(100)
camera.clip_plane_near = 1 camera.clip_plane_near = 1
camera.look_at(Vec3(0, 0, 0)) camera.look_at(Vec3(0, 0, 0))
...@@ -248,7 +253,7 @@ class CenterPointMovingSimLive(EarthSeasonsSimBase): ...@@ -248,7 +253,7 @@ class CenterPointMovingSimLive(EarthSeasonsSimBase):
ec.world_position += ec.right * 0.8 * _dt* UrsinaConfig.run_speed_factor # 左 ec.world_position += ec.right * 0.8 * _dt* UrsinaConfig.run_speed_factor # 左
d_sun = self.get_distance_sun() d_sun = self.get_distance_sun()
# print("d_sun:", d_sun) # print("d_sun:", d_sun)
if d_sun > 45: if d_sun > 48:
self.phase_num = 5 self.phase_num = 5
# elif self.phase_num == 5: # elif self.phase_num == 5:
# ec.world_position -= ec.back * 1.4* _dt * UrsinaConfig.run_speed_factor # 下 # ec.world_position -= ec.back * 1.4* _dt * UrsinaConfig.run_speed_factor # 下
...@@ -327,7 +332,7 @@ if __name__ == '__main__': ...@@ -327,7 +332,7 @@ if __name__ == '__main__':
""" """
sim = CenterPointMovingSimLive() sim = CenterPointMovingSimLive()
sim.run( sim.run(
dt=SECONDS_PER_DAY * 10, dt=SECONDS_PER_DAY * 15,
# dt=SECONDS_PER_DAY * 3, # dt=SECONDS_PER_DAY * 3,
init_position=[0, -60 * AU, 30 * AU], init_position=[0, -60 * AU, 30 * AU],
show_exit_button=False, show_exit_button=False,
......
...@@ -296,7 +296,7 @@ def create_trail_curve_line(parent, pos): ...@@ -296,7 +296,7 @@ def create_trail_curve_line(parent, pos):
vertices=((pos[0], pos[1], pos[2]), (trail_last_pos[0], trail_last_pos[1], trail_last_pos[2])), vertices=((pos[0], pos[1], pos[2]), (trail_last_pos[0], trail_last_pos[1], trail_last_pos[2])),
mode='line', mode='line',
thickness=UrsinaConfig.trail_thickness_factor), thickness=UrsinaConfig.trail_thickness_factor),
color=parent.trail_color, alpha=0.5) color=parent.trail_color, alpha=UrsinaConfig.trail_alpha)
trail.set_light_off() trail.set_light_off()
else: else:
pass pass
......
...@@ -17,6 +17,7 @@ class UrsinaConfig: ...@@ -17,6 +17,7 @@ class UrsinaConfig:
auto_scale_factor = 1.0 # __SCALE_FACTOR 不能满足,需要自动进行调整 auto_scale_factor = 1.0 # __SCALE_FACTOR 不能满足,需要自动进行调整
trail_factor = 1.0 # 拖尾大小因子。默认为1.0 trail_factor = 1.0 # 拖尾大小因子。默认为1.0
trail_thickness_factor = 1.0 # 线条拖尾厚度大小因子。默认为1.0 trail_thickness_factor = 1.0 # 线条拖尾厚度大小因子。默认为1.0
trail_alpha = 0.5
# 旋转因子为1,则为正常的转速 # 旋转因子为1,则为正常的转速
ROTATION_SPEED_FACTOR = 1.0 ROTATION_SPEED_FACTOR = 1.0
# ROTATION_SPEED_FACTOR = 0.01 # ROTATION_SPEED_FACTOR = 0.01
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册