Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
b50558b1
宇宙模拟器
项目概览
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看板
提交
b50558b1
编写于
12月 12, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
3a0f31d4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
31 deletion
+36
-31
sim_scenes/featured/eight_stars_alignment.py
sim_scenes/featured/eight_stars_alignment.py
+4
-4
sim_scenes/featured/the_lost_planet.py
sim_scenes/featured/the_lost_planet.py
+32
-27
未找到文件。
sim_scenes/featured/eight_stars_alignment.py
浏览文件 @
b50558b1
...
@@ -198,9 +198,9 @@ class SolarSystemRealitySim(UniverseSimScenes):
...
@@ -198,9 +198,9 @@ class SolarSystemRealitySim(UniverseSimScenes):
target
=
self
.
targets
[
self
.
target_index
]
target
=
self
.
targets
[
self
.
target_index
]
planet
=
target
.
planet
.
main_entity
planet
=
target
.
planet
.
main_entity
camera
.
look_at
(
planet
)
#
camera.look_at(planet)
#
camera
.
position
=
self
.
ship
.
planet
.
position
+
Vec3
(
10
,
10
,
10
)
#
camera.position = self.ship.planet.position + Vec3(10, 10, 10)
dt
=
time_data
.
get_datetime
(
str
(
self
.
start_time
))
dt
=
time_data
.
get_datetime
(
str
(
self
.
start_time
))
# 设置天体的位置(包含速度和加速度的信息)
# 设置天体的位置(包含速度和加速度的信息)
self
.
set_bodies_position
(
time_data
)
self
.
set_bodies_position
(
time_data
)
...
@@ -286,7 +286,7 @@ if __name__ == '__main__':
...
@@ -286,7 +286,7 @@ if __name__ == '__main__':
dt
=
SECONDS_PER_DAY
,
# 1秒=1天
dt
=
SECONDS_PER_DAY
,
# 1秒=1天
# dt=SECONDS_PER_WEEK, # 1秒=1周
# dt=SECONDS_PER_WEEK, # 1秒=1周
# dt=SECONDS_PER_HOUR, # 1秒=1小时
# dt=SECONDS_PER_HOUR, # 1秒=1小时
start_time
=
'2149-
12-10
12:00:00'
,
# 九(八)星连珠的时间 # https://baijiahao.baidu.com/s?id=1654160345900112362
start_time
=
'2149-
01-01
12:00:00'
,
# 九(八)星连珠的时间 # https://baijiahao.baidu.com/s?id=1654160345900112362
# show_asteroids=True, # 是否显示小行星带(图片模拟)
# show_asteroids=True, # 是否显示小行星带(图片模拟)
show_earth_clouds
=
True
,
# 地球是否显示云层(图片效果,不是真实的云层)
show_earth_clouds
=
True
,
# 地球是否显示云层(图片效果,不是真实的云层)
# recalc_moon_pos=False, # 为了更好的展示效果,需要对月球的位置重新计算(使得地月距离放大,月球相对地球方向不变)
# recalc_moon_pos=False, # 为了更好的展示效果,需要对月球的位置重新计算(使得地月距离放大,月球相对地球方向不变)
...
...
sim_scenes/featured/the_lost_planet.py
浏览文件 @
b50558b1
...
@@ -239,27 +239,34 @@ class TheLostPlanetSim(UniverseSimScenes):
...
@@ -239,27 +239,34 @@ class TheLostPlanetSim(UniverseSimScenes):
def
init_steps
(
self
):
def
init_steps
(
self
):
def
earth_orbit_the_sun
():
def
earth_orbit_the_sun
():
if
not
hasattr
(
self
,
"moon_aroundearth"
):
self
.
body_orbit_the_sun
(
self
.
earth
,
90
)
# setattr(self, "step_04", True)
self
.
body_orbit_the_sun
(
self
.
earth
,
90
)
def
mars_orbit_the_sun
():
self
.
body_orbit_the_sun
(
self
.
mars
,
90
)
self
.
body_orbit_the_sun
(
self
.
mars
,
90
)
self
.
body_orbit_the_sun
(
self
.
venus
,
90
)
self
.
body_orbit_the_sun
(
self
.
mercury
,
90
)
def
venus_orbit_the_sun
():
self
.
body_orbit_the_sun
(
self
.
venus
,
90
)
def
mercury_orbit_the_sun
():
self
.
body_orbit_the_sun
(
self
.
mercury
,
90
)
def
jupter_orbit_the_sun
():
def
jupter_orbit_the_sun
():
if
not
hasattr
(
self
,
"moon_aroundearth"
):
self
.
body_orbit_the_sun
(
self
.
jupiter
,
90
)
# setattr(self, "step_04", True)
self
.
body_orbit_the_sun
(
self
.
jupiter
,
90
)
self
.
body_orbit_the_sun
(
self
.
saturn
,
90
)
def
saturn_orbit_the_sun
():
self
.
body_orbit_the_sun
(
self
.
saturn
,
90
)
self
.
steps
=
[
self
.
steps
=
[
(
earth_orbit_the_sun
,
3
,
1
),
(
mercury_orbit_the_sun
,
100
,
1
),
(
jupter_orbit_the_sun
,
3
,
1
),
(
venus_orbit_the_sun
,
100
,
1
),
(
self
.
asteroid_fade_in
,
3
,
1
),
(
earth_orbit_the_sun
,
100
,
1
),
(
self
.
asteroid_fade_out
,
3
,
1
),
(
mars_orbit_the_sun
,
600
,
1
),
# fun, wait_years, run_times
(
jupter_orbit_the_sun
,
100
,
1
),
(
self
.
camera_back_1
,
3
,
-
1
),
(
saturn_orbit_the_sun
,
600
,
1
),
(
self
.
asteroid_fade_in
,
900
,
1
),
(
self
.
asteroid_fade_out
,
900
,
1
),
# fun, wait_days, run_times
(
self
.
camera_back_1
,
900
,
-
1
),
(
self
.
camera_back_2
,
-
1
,
-
1
),
(
self
.
camera_back_2
,
-
1
,
-
1
),
(
lambda
:
None
,
-
1
,
-
1
)
(
lambda
:
None
,
-
1
,
-
1
)
]
]
...
@@ -286,31 +293,29 @@ class TheLostPlanetSim(UniverseSimScenes):
...
@@ -286,31 +293,29 @@ class TheLostPlanetSim(UniverseSimScenes):
body
.
planet
.
update
=
orbit_update
body
.
planet
.
update
=
orbit_update
def
camera_back_1
(
self
):
def
camera_back_1
(
self
):
return
if
camera
.
position
[
2
]
<
460
:
if
camera
.
position
[
0
]
<
460
:
camera
.
position
+=
camera
.
back
camera
.
position
+=
camera
.
back
def
camera_back_2
(
self
):
def
camera_back_2
(
self
):
return
if
camera
.
position
[
2
]
<
550
:
if
camera
.
position
[
0
]
<
550
:
# camera.position += camera.right
# camera.position += camera.right
camera
.
position
+=
camera
.
back
camera
.
position
+=
camera
.
back
def
on_timer_changed
(
self
,
time_data
):
def
on_timer_changed
(
self
,
time_data
):
# camera.position += camera.right
# camera.position += camera.right
if
time_data
.
years
>
1
:
if
time_data
.
total_days
>
0
:
if
self
.
step_index
>
len
(
self
.
steps
)
-
1
:
if
self
.
step_index
>
len
(
self
.
steps
)
-
1
:
self
.
step_index
=
len
(
self
.
steps
)
-
1
self
.
step_index
=
len
(
self
.
steps
)
-
1
fun
,
wait_
year
s
,
run_times
=
self
.
steps
[
self
.
step_index
]
fun
,
wait_
day
s
,
run_times
=
self
.
steps
[
self
.
step_index
]
if
not
hasattr
(
self
,
f
"
{
fun
.
__name__
}
_wait_
year
s"
):
if
not
hasattr
(
self
,
f
"
{
fun
.
__name__
}
_wait_
day
s"
):
setattr
(
self
,
f
"
{
fun
.
__name__
}
_wait_
years"
,
time_data
.
year
s
)
setattr
(
self
,
f
"
{
fun
.
__name__
}
_wait_
days"
,
time_data
.
total_day
s
)
setattr
(
self
,
f
"
{
fun
.
__name__
}
_run_times"
,
0
)
setattr
(
self
,
f
"
{
fun
.
__name__
}
_run_times"
,
0
)
fun_run_times
=
getattr
(
self
,
f
"
{
fun
.
__name__
}
_run_times"
)
fun_run_times
=
getattr
(
self
,
f
"
{
fun
.
__name__
}
_run_times"
)
if
fun_run_times
<
run_times
or
run_times
<
0
:
if
fun_run_times
<
run_times
or
run_times
<
0
:
fun
()
fun
()
setattr
(
self
,
f
"
{
fun
.
__name__
}
_run_times"
,
fun_run_times
+
1
)
setattr
(
self
,
f
"
{
fun
.
__name__
}
_run_times"
,
fun_run_times
+
1
)
fun_wait_
years
=
getattr
(
self
,
f
"
{
fun
.
__name__
}
_wait_year
s"
)
fun_wait_
days
=
getattr
(
self
,
f
"
{
fun
.
__name__
}
_wait_day
s"
)
if
wait_
years
+
fun_wait_years
<
time_data
.
years
and
wait_year
s
>
0
:
if
wait_
days
+
fun_wait_days
<
time_data
.
total_days
and
wait_day
s
>
0
:
self
.
step_index
+=
1
self
.
step_index
+=
1
# print(self.step_index, fun.__name__)
# print(self.step_index, fun.__name__)
...
@@ -335,7 +340,7 @@ if __name__ == '__main__':
...
@@ -335,7 +340,7 @@ if __name__ == '__main__':
# position=(0, 2 * AU, -11 * AU),
# position=(0, 2 * AU, -11 * AU),
# position=(0, 20 * AU, 10 * AU),
# position=(0, 20 * AU, 10 * AU),
# position=(4.5 * AU, AU, 5 * AU),
# position=(4.5 * AU, AU, 5 * AU),
position
=
(
5
*
AU
,
AU
/
2
,
-
5
*
AU
),
position
=
(
5
*
AU
,
AU
/
2
,
-
5
*
AU
),
timer_enabled
=
True
,
timer_enabled
=
True
,
# show_timer=True,
# show_timer=True,
cosmic_bg
=
''
,
cosmic_bg
=
''
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录