Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
6c8b3e0c
宇宙模拟器
项目概览
Python_超人
/
宇宙模拟器
通知
19
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
宇宙模拟器
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6c8b3e0c
编写于
3月 05, 2024
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
24de21fe
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
46 addition
and
12 deletion
+46
-12
sim_scenes/featured/solar_system_explorer.py
sim_scenes/featured/solar_system_explorer.py
+46
-12
未找到文件。
sim_scenes/featured/solar_system_explorer.py
浏览文件 @
6c8b3e0c
...
@@ -39,9 +39,11 @@ class SolarSystemExplorer(UniverseSimScenes):
...
@@ -39,9 +39,11 @@ class SolarSystemExplorer(UniverseSimScenes):
def
build_solar_system
(
self
):
def
build_solar_system
(
self
):
# region 构建太阳系
# region 构建太阳系
show_trail
=
False
show_trail
=
False
self
.
SIZE_FACTOR
=
0.01
self
.
SIZE_FACTOR
=
0.1
# 0.01
self
.
init_pos
=
[
2
*
AU
,
2
*
AU
,
-
10
*
AU
]
# self.init_pos = [2 * AU, 2 * AU, 5 * AU]
self
.
sun
=
Sun
(
size_scale
=
20e2
*
self
.
SIZE_FACTOR
,
show_trail
=
show_trail
,
# self.init_pos = [1.8 * AU, 1.8 * AU, 4.5 * AU]
self
.
init_pos
=
[
1.8
*
AU
,
1.8
*
AU
,
4.5
*
AU
]
self
.
sun
=
Sun
(
size_scale
=
2e2
*
self
.
SIZE_FACTOR
,
show_trail
=
show_trail
,
# color=(255, 250, 245),
# color=(255, 250, 245),
# texture="",
# texture="",
texture
=
"sun_light.jpg"
texture
=
"sun_light.jpg"
...
@@ -62,20 +64,36 @@ class SolarSystemExplorer(UniverseSimScenes):
...
@@ -62,20 +64,36 @@ class SolarSystemExplorer(UniverseSimScenes):
# init_position=[0, 0, 0],
# init_position=[0, 0, 0],
init_position
=
self
.
init_pos
,
init_position
=
self
.
init_pos
,
init_velocity
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
texture
=
'transparent.png'
,
size_scale
=
1e3
*
self
.
SIZE_FACTOR
).
set_ignore_gravity
(
True
)
size_scale
=
1e3
*
self
.
SIZE_FACTOR
).
set_ignore_gravity
(
True
)
# self.bodies = [
# self.sun, # 太阳
# self.mercury, # 水星
# self.venus, # 金星
# self.earth, # 地球
# self.mars, # 火星
# self.jupiter, # 木星
# self.saturn, # 土星
# self.uranus, # 天王星
# self.neptune, # 海王星
# self.pluto, # 冥王星
# self.camera_target
# ]
self
.
bodies
=
[
self
.
bodies
=
[
self
.
sun
,
# 太阳
self
.
camera_target
,
self
.
saturn
,
# 土星
self
.
mars
,
# 火星
self
.
earth
,
# 地球
self
.
mercury
,
# 水星
self
.
mercury
,
# 水星
self
.
sun
,
# 太阳
self
.
venus
,
# 金星
self
.
venus
,
# 金星
self
.
earth
,
# 地球
self
.
mars
,
# 火星
self
.
jupiter
,
# 木星
self
.
jupiter
,
# 木星
self
.
saturn
,
# 土星
self
.
uranus
,
# 天王星
self
.
uranus
,
# 天王星
self
.
neptune
,
# 海王星
self
.
neptune
,
# 海王星
self
.
pluto
,
# 冥王星
#
self.pluto, # 冥王星
self
.
camera_target
]
]
self
.
sun
.
target_offset
=
[
1
,
1
,
1.1
]
self
.
sun
.
target_offset
=
[
1
,
1
,
1.1
]
...
@@ -100,7 +118,18 @@ class SolarSystemExplorer(UniverseSimScenes):
...
@@ -100,7 +118,18 @@ class SolarSystemExplorer(UniverseSimScenes):
self
.
neptune
.
dd_factor
=
1.5
self
.
neptune
.
dd_factor
=
1.5
self
.
pluto
.
dd_factor
=
1.5
self
.
pluto
.
dd_factor
=
1.5
init_bodies_pos_vels
(
self
.
bodies
,
init_pos_vels_fun
=
self
.
get_init_pos_vels
)
self
.
init_pos_vels
()
# init_bodies_pos_vels(self.bodies, init_pos_vels_fun=self.get_init_pos_vels)
def
init_pos_vels
(
self
):
from
astropy.time
import
Time
from
datetime
import
datetime
start_time
=
Time
(
datetime
.
strptime
(
'2149-02-01 12:00:00+0800'
,
'%Y-%m-%d %H:%M:%S%z'
),
format
=
'datetime'
)
# set_solar_system_celestial_position(self.bodies, start_time, True)
init_bodies_reality_pos_vels
(
self
.
bodies
,
start_time
)
def
get_init_pos_vels
(
self
):
def
get_init_pos_vels
(
self
):
init_pos_vels
=
{}
init_pos_vels
=
{}
...
@@ -234,7 +263,7 @@ class SolarSystemExplorer(UniverseSimScenes):
...
@@ -234,7 +263,7 @@ class SolarSystemExplorer(UniverseSimScenes):
value_conv
=
self
.
s_f
,
smooth
=
1
)
value_conv
=
self
.
s_f
,
smooth
=
1
)
def
get_target
(
self
):
def
get_target
(
self
):
for
body
in
self
.
bodies
:
for
body
in
self
.
bodies
[
1
:]
:
if
hasattr
(
body
,
"is_arrived"
):
if
hasattr
(
body
,
"is_arrived"
):
continue
continue
return
body
return
body
...
@@ -258,11 +287,15 @@ class SolarSystemExplorer(UniverseSimScenes):
...
@@ -258,11 +287,15 @@ class SolarSystemExplorer(UniverseSimScenes):
camera
.
speed
=
4e2
camera
.
speed
=
4e2
self
.
camera_target
.
planet
.
update
=
lambda
:
None
self
.
camera_target
.
planet
.
update
=
lambda
:
None
# 显示网格以及坐标线
# 显示网格以及坐标线
# self.show_grid_axises()
# self.show_grid_axises(scale_factor=50)
target
=
self
.
get_target
()
camera_look_at
(
self
.
saturn
,
rotation_z
=
0
)
def
go_target
(
self
):
def
go_target
(
self
):
from
ursina
import
distance
from
ursina
import
distance
target
=
self
.
get_target
()
target
=
self
.
get_target
()
if
target
is
None
:
return
target_scale
=
target
.
planet
.
scale_x
target_scale
=
target
.
planet
.
scale_x
target_offset
=
target
.
target_offset
target_offset
=
target
.
target_offset
...
@@ -302,6 +335,7 @@ class SolarSystemExplorer(UniverseSimScenes):
...
@@ -302,6 +335,7 @@ class SolarSystemExplorer(UniverseSimScenes):
@param time_data:
@param time_data:
@return:
@return:
"""
"""
# return
self
.
go_target
()
self
.
go_target
()
# self.camera_move(time_data)
# self.camera_move(time_data)
# self.current_stage()
# self.current_stage()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录