Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
4079b23c
宇宙模拟器
项目概览
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看板
提交
4079b23c
编写于
12月 08, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
5a7a24dc
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
29 addition
and
1 deletion
+29
-1
sim_lab/the_lost_planet.py
sim_lab/the_lost_planet.py
+29
-1
未找到文件。
sim_lab/the_lost_planet.py
浏览文件 @
4079b23c
...
@@ -10,6 +10,8 @@ import time
...
@@ -10,6 +10,8 @@ import time
from
bodies
import
Sun
,
Mercury
,
Venus
,
Earth
,
Mars
,
Moon
,
Ceres
,
Jupiter
,
Saturn
,
Uranus
,
Neptune
,
Pluto
,
Asteroids
from
bodies
import
Sun
,
Mercury
,
Venus
,
Earth
,
Mars
,
Moon
,
Ceres
,
Jupiter
,
Saturn
,
Uranus
,
Neptune
,
Pluto
,
Asteroids
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_DAY
,
SECONDS_PER_MONTH
,
SECONDS_PER_YEAR
,
AU
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_DAY
,
SECONDS_PER_MONTH
,
SECONDS_PER_YEAR
,
AU
from
objs
import
CoreValagaClas
,
ScifiGunship
,
SpaceShip
,
StarWarsSpeeder
,
SciFiBomber
from
objs.battleship
import
BattleShip
from
sim_scenes.func
import
mayavi_run
,
ursina_run
,
create_sphere_sky
from
sim_scenes.func
import
mayavi_run
,
ursina_run
,
create_sphere_sky
from
sim_scenes.universe_sim_scenes
import
UniverseSimScenes
from
sim_scenes.universe_sim_scenes
import
UniverseSimScenes
from
simulators.func
import
ext_fun_for_method
from
simulators.func
import
ext_fun_for_method
...
@@ -34,6 +36,13 @@ class TheLostPlanetSim(UniverseSimScenes):
...
@@ -34,6 +36,13 @@ class TheLostPlanetSim(UniverseSimScenes):
self
.
mars
=
Mars
(
size_scale
=
3e3
,
distance_scale
=
2.9
)
self
.
mars
=
Mars
(
size_scale
=
3e3
,
distance_scale
=
2.9
)
self
.
jupiter
=
Jupiter
(
size_scale
=
0.68e3
,
distance_scale
=
1.12
)
self
.
jupiter
=
Jupiter
(
size_scale
=
0.68e3
,
distance_scale
=
1.12
)
self
.
saturn
=
Saturn
(
size_scale
=
0.68e3
,
distance_scale
=
0.74
)
self
.
saturn
=
Saturn
(
size_scale
=
0.68e3
,
distance_scale
=
0.74
)
self
.
ship
=
ScifiGunship
(
name
=
"飞船"
,
mass
=
1e30
,
color
=
(
111
,
140
,
255
),
init_position
=
self
.
mars
.
init_position
,
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
2e4
,
distance_scale
=
2.9
).
\
set_ignore_gravity
(
True
).
set_light_disable
(
True
)
self
.
bodies
=
[
self
.
bodies
=
[
self
.
sun
,
self
.
sun
,
Mercury
(
size_scale
=
3e3
,
distance_scale
=
7.3
),
# 水星放大 4000 倍
Mercury
(
size_scale
=
3e3
,
distance_scale
=
7.3
),
# 水星放大 4000 倍
...
@@ -89,7 +98,7 @@ class TheLostPlanetSim(UniverseSimScenes):
...
@@ -89,7 +98,7 @@ class TheLostPlanetSim(UniverseSimScenes):
else
:
else
:
an
=
0.4
+
0.3
*
pow
(
2
,
planet_no
-
2
)
an
=
0.4
+
0.3
*
pow
(
2
,
planet_no
-
2
)
# print(body.name, an, body.position[2] / AU)
# print(body.name, an, body.position[2] / AU)
self
.
bodies
+=
[
self
.
ship
]
self
.
step_index
=
0
self
.
step_index
=
0
self
.
init_steps
()
self
.
init_steps
()
...
@@ -291,6 +300,24 @@ class TheLostPlanetSim(UniverseSimScenes):
...
@@ -291,6 +300,24 @@ class TheLostPlanetSim(UniverseSimScenes):
for
a
in
self
.
asteroids
:
for
a
in
self
.
asteroids
:
self
.
set_alpha_animation
(
a
,
1.0
,
0.0
,
0.01
,
is_destroy
=
True
)
self
.
set_alpha_animation
(
a
,
1.0
,
0.0
,
0.01
,
is_destroy
=
True
)
def
ship_go_to_moon
(
self
):
planet
=
self
.
ship
.
planet
origin_udpate
=
planet
.
update
def
go_to_moon
():
# origin_udpate()
self
.
ship
.
planet
.
look_at
(
self
.
moon
.
planet
)
planet
.
position
+=
planet
.
forward
*
20
planet
.
rotation_x
=
0
d
=
distance
(
planet
,
self
.
moon
.
planet
)
if
d
<
2
:
planet
.
update
=
lambda
:
None
planet
.
enabled
=
False
self
.
step_index
+=
1
planet
.
update
=
go_to_moon
def
moon_fade_in
(
self
):
def
moon_fade_in
(
self
):
"""
"""
月球渐渐显示
月球渐渐显示
...
@@ -385,6 +412,7 @@ class TheLostPlanetSim(UniverseSimScenes):
...
@@ -385,6 +412,7 @@ class TheLostPlanetSim(UniverseSimScenes):
(
self
.
asteroid_fade_in
,
3
,
1
),
(
self
.
asteroid_fade_in
,
3
,
1
),
(
self
.
asteroid_fade_out
,
3
,
1
),
(
self
.
asteroid_fade_out
,
3
,
1
),
(
self
.
moon_fade_in
,
3
,
1
),
(
self
.
moon_fade_in
,
3
,
1
),
# (self.ship_go_to_moon, -1, 1),
(
self
.
moon_renovation
,
10
,
-
1
),
(
self
.
moon_renovation
,
10
,
-
1
),
(
step_05
,
-
1
,
-
1
),
(
step_05
,
-
1
,
-
1
),
(
step_06
,
-
1
,
-
1
),
(
step_06
,
-
1
,
-
1
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录