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

Python超人-宇宙模拟器

上级 fe8320fd
......@@ -16,22 +16,29 @@ if __name__ == '__main__':
自由落地模拟
"""
# 地球在中心位置
e = Earth(init_position=[0, 0, 0], size_scale=1, texture="earth_hd.jpg", init_velocity=[0, 0, 0])
earth = Earth(init_position=[0, 0, 0], size_scale=1, texture="earth_hd.jpg", init_velocity=[0, 0, 0])
# e.raduis = 6373.22
# math.sqrt(pow(6373.22 + 500, 2) + pow(500, 2))-6373.22
# math.sqrt(pow(6373.22 + 1000, 2) + pow(500, 2))-6373.22
# 创建的3个不同质量,不同高度的物体,观察地球表面上的加速度
bodies = [
e,
earth,
Football(mass=500, size_scale=3e2, trail_color=[255, 0, 0],
init_position=[-500, e.raduis + 500, 0], # 球在地面上 500km
init_velocity=[0, 0, 0]),
Football(mass=5000, size_scale=3.8e2,
init_position=[500, e.raduis + 1000, 0], # 球在地面上 500km
init_velocity=[0, 0, 0]),
init_position=[-500, earth.raduis + 500, 0], # 球在地面上 518 多公里(向左偏移500公里)
init_velocity=[0, 0, 0], gravity_only_for=[earth]),
Football(mass=1000, size_scale=3e2, trail_color=[0, 255, 0],
init_position=[0, earth.raduis + 800, 0], # 球在地面上 800 多公里
init_velocity=[0, 0, 0], gravity_only_for=[earth]),
Football(mass=5000, size_scale=3.8e2, trail_color=[0, 0, 255],
init_position=[500, earth.raduis + 1000, 0], # 球在地面上 1016 多公里(向右偏移500公里)
init_velocity=[0, 0, 0], gravity_only_for=[earth]),
]
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run(bodies, SECONDS_PER_MINUTE, # 一秒相当于一分钟
position=(0, e.raduis + 500, -4500),
position=(0, earth.raduis + 500, -4500),
show_trail=True,
show_timer=True,
view_closely=0.001)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册