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

Python超人-宇宙模拟器

上级 a39aa76d
# -*- coding:utf-8 -*-
# title :高清冥王星3D效果
# description :高清冥王星3D效果
# author :Python超人
# date :2023-10-09
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from bodies import Pluto
from common.consts import SECONDS_PER_WEEK, SECONDS_PER_DAY
from sim_scenes.func import ursina_run
if __name__ == '__main__':
"""
高清冥王星3D效果
"""
bodies = [
Pluto(texture="pluto.png",
init_position=[0, 0, 0], init_velocity=[0, 0, 0],
size_scale=2, show_name=False)
]
pluto = bodies[0]
# TODO: 开启3D摄像机
from simulators.ursina.entities.camera3d import Camera3d
# 3D摄像机初始化(两眼到鼻梁的距离为1000公里效果)
Camera3d.init(eye_distance=1000)
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run(bodies, SECONDS_PER_DAY,
position=(4 * pluto.radius, 0, -13500),
# cosmic_bg="", # 无背景(黑色)
show_grid=False, # 不显示网格
show_camera_info=False, # 不显示摄像机信息
show_control_info=False, # 不显示控制提示信息
view_closely=0.001)
# -*- coding:utf-8 -*-
# title :高清金星3D效果
# description :高清金星3D效果
# author :Python超人
# date :2023-10-09
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from bodies import Venus
from common.consts import SECONDS_PER_WEEK, SECONDS_PER_DAY
from sim_scenes.func import ursina_run
if __name__ == '__main__':
"""
高清金星3D效果
"""
bodies = [
Venus(texture="venus_hd.jpg",
init_position=[0, 0, 0], init_velocity=[0, 0, 0],
size_scale=1, show_name=False)
]
venus = bodies[0]
# TODO: 开启3D摄像机
from simulators.ursina.entities.camera3d import Camera3d
# 3D摄像机初始化(两眼到鼻梁的距离为1000公里效果)
Camera3d.init(eye_distance=1000)
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run(bodies, SECONDS_PER_DAY,
position=(1.4 * venus.radius, 0, -28000),
# cosmic_bg="", # 无背景(黑色)
show_grid=False, # 不显示网格
show_camera_info=False, # 不显示摄像机信息
show_control_info=False, # 不显示控制提示信息
view_closely=0.001)
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
# title :三体场景模拟01 # title :三体场景模拟
# description :三体场景模拟(3个太阳、1个地球) # description :三体场景模拟(3个太阳、1个地球)
# author :Python超人 # author :Python超人
# date :2023-02-11 # date :2023-02-11
......
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
# title :体场景模拟01 # title :体场景模拟01
# description :三体场景模拟(2个太阳、1个地球) # description :两体场景模拟01(2个太阳、1个地球)
# author :Python超人 # author :Python超人
# date :2023-02-11 # date :2023-02-11
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
......
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
# title :地月场景模拟 # title :三体水滴场景模拟
# description :地月场景模拟(月球始终一面朝向地球、月球对地球的扰动) # description :三体水滴场景模拟
# author :Python超人 # author :Python超人
# date :2023-05-01 # date :2023-05-01
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
...@@ -20,8 +20,7 @@ from ursina import camera ...@@ -20,8 +20,7 @@ from ursina import camera
if __name__ == '__main__': if __name__ == '__main__':
""" """
月球始终一面朝向地球 三体水滴场景模拟
月球对地球的扰动
""" """
OFFSETTING = 0 OFFSETTING = 0
WATER_SPEED = 400 WATER_SPEED = 400
......
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
# title :地月场景模拟 # title :三体水滴场景模拟
# description :地月场景模拟(月球始终一面朝向地球、月球对地球的扰动) # description :三体水滴场景模拟
# author :Python超人 # author :Python超人
# date :2023-05-01 # date :2023-05-01
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
...@@ -20,8 +20,7 @@ from ursina import camera ...@@ -20,8 +20,7 @@ from ursina import camera
if __name__ == '__main__': if __name__ == '__main__':
""" """
月球始终一面朝向地球 三体水滴场景模拟
月球对地球的扰动
""" """
OFFSETTING = 0 OFFSETTING = 0
WATER_SPEED = 400 WATER_SPEED = 400
...@@ -46,12 +45,12 @@ if __name__ == '__main__': ...@@ -46,12 +45,12 @@ if __name__ == '__main__':
water_drop = WaterDrop( water_drop = WaterDrop(
init_position=[0, 0, 0], init_position=[0, 0, 0],
# texture="drops_bright.png", # texture="drops_bright.png",
# trail_color=[200, 200, 255], # trail_color=[200, 200, 255],
init_velocity=[0, 0, 0], init_velocity=[0, 0, 0],
# size_scale=4e4, # size_scale=4e4,
size_scale=3e3 size_scale=3e3
).set_ignore_gravity(True).set_light_disable(True) ).set_ignore_gravity(True).set_light_disable(True)
# moon = Moon(init_position=[0, 0, 363104], # 距地距离约: 363104 至 405696 km # moon = Moon(init_position=[0, 0, 363104], # 距地距离约: 363104 至 405696 km
# init_velocity=[-1.03, 0, 0], size_scale=2e1) # 月球放大 10 倍,距离保持不变 # init_velocity=[-1.03, 0, 0], size_scale=2e1) # 月球放大 10 倍,距离保持不变
# moon.set_light_disable(True) # moon.set_light_disable(True)
...@@ -114,12 +113,10 @@ if __name__ == '__main__': ...@@ -114,12 +113,10 @@ if __name__ == '__main__':
application.time_scale = 1 application.time_scale = 1
# # 订阅事件后,上面2个函数功能才会起作用 # # 订阅事件后,上面2个函数功能才会起作用
# # 运行前会触发 on_ready # # 运行前会触发 on_ready
UrsinaEvent.on_ready_subscription(on_ready) UrsinaEvent.on_ready_subscription(on_ready)
# 使用 ursina 查看的运行效果 # 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后- # position = 左-右+、上+下-、前+后-
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册