Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
628ad79b
宇宙模拟器
项目概览
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看板
提交
628ad79b
编写于
12月 09, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
d28fe8b2
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
17 addition
and
5 deletion
+17
-5
sim_scenes/featured/eight_stars_alignment.py
sim_scenes/featured/eight_stars_alignment.py
+17
-5
未找到文件。
sim_scenes/featured/eight_stars_alignment.py
浏览文件 @
628ad79b
...
@@ -12,7 +12,7 @@ import numpy as np
...
@@ -12,7 +12,7 @@ import numpy as np
from
bodies
import
Sun
,
Mercury
,
Venus
,
Earth
,
Mars
,
Asteroids
,
Jupiter
,
Saturn
,
Uranus
,
Neptune
,
Moon
from
bodies
import
Sun
,
Mercury
,
Venus
,
Earth
,
Mars
,
Asteroids
,
Jupiter
,
Saturn
,
Uranus
,
Neptune
,
Moon
from
common.celestial_data_service
import
get_body_posvel
,
recalc_moon_position
,
calc_solar_acceleration
,
\
from
common.celestial_data_service
import
get_body_posvel
,
recalc_moon_position
,
calc_solar_acceleration
,
\
set_solar_system_celestial_position
,
set_earth_rotation
set_solar_system_celestial_position
,
set_earth_rotation
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_DAY
,
SECONDS_PER_HOUR
,
AU
from
common.consts
import
SECONDS_PER_
MONTH
,
SECONDS_PER_
WEEK
,
SECONDS_PER_DAY
,
SECONDS_PER_HOUR
,
AU
from
sim_scenes.func
import
ursina_run
,
create_sphere_sky
,
two_bodies_colliding
from
sim_scenes.func
import
ursina_run
,
create_sphere_sky
,
two_bodies_colliding
from
sim_scenes.universe_sim_scenes
import
UniverseSimScenes
from
sim_scenes.universe_sim_scenes
import
UniverseSimScenes
from
simulators.ursina.entities.body_timer
import
TimeData
from
simulators.ursina.entities.body_timer
import
TimeData
...
@@ -150,11 +150,14 @@ class SolarSystemRealitySim(UniverseSimScenes):
...
@@ -150,11 +150,14 @@ class SolarSystemRealitySim(UniverseSimScenes):
# 需要按照时间和日期来控制地球的自转,所以删除控制地球自转的属性
# 需要按照时间和日期来控制地球的自转,所以删除控制地球自转的属性
delattr
(
self
.
earth
.
planet
,
"rotation_speed"
)
delattr
(
self
.
earth
.
planet
,
"rotation_speed"
)
delattr
(
self
.
earth
.
planet
,
"rotspeed"
)
delattr
(
self
.
earth
.
planet
,
"rotspeed"
)
self
.
ship
.
planet
.
update
=
lambda
:
None
# 设置后,可以调整鼠标键盘的控制速度
# 设置后,可以调整鼠标键盘的控制速度
application
.
time_scale
=
1
application
.
time_scale
=
0.0
1
self
.
ship
.
planet
.
position
=
self
.
earth
.
planet
.
position
self
.
ship
.
planet
.
position
=
self
.
earth
.
planet
.
position
self
.
ship
.
planet
.
update
=
lambda
:
None
camera
.
update
=
lambda
:
None
def
ship_go_target
(
self
):
def
ship_go_target
(
self
):
from
ursina
import
distance
from
ursina
import
distance
...
@@ -170,7 +173,7 @@ class SolarSystemRealitySim(UniverseSimScenes):
...
@@ -170,7 +173,7 @@ class SolarSystemRealitySim(UniverseSimScenes):
# r = d * 10
# r = d * 10
# if r<100:
# if r<100:
# r = 100
# r = 100
r
=
50
0
r
=
2
0
self
.
ship
.
planet
.
look_at
(
planet
)
self
.
ship
.
planet
.
look_at
(
planet
)
self
.
ship
.
planet
.
position
+=
self
.
ship
.
planet
.
forward
*
r
self
.
ship
.
planet
.
position
+=
self
.
ship
.
planet
.
forward
*
r
...
@@ -181,14 +184,23 @@ class SolarSystemRealitySim(UniverseSimScenes):
...
@@ -181,14 +184,23 @@ class SolarSystemRealitySim(UniverseSimScenes):
self
.
target_index
+=
1
self
.
target_index
+=
1
planet
.
arrived
=
True
planet
.
arrived
=
True
def
on_timer_changed
(
self
,
time_data
:
TimeData
):
def
on_timer_changed
(
self
,
time_data
:
TimeData
):
"""
"""
事件绑定后,时时刻刻都会触发
事件绑定后,时时刻刻都会触发
@param time_data:
@param time_data:
@return:
@return:
"""
"""
from
ursina
import
Vec3
self
.
ship_go_target
()
self
.
ship_go_target
()
target
=
self
.
targets
[
self
.
target_index
]
planet
=
target
.
planet
.
main_entity
camera
.
look_at
(
planet
)
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
)
...
@@ -272,7 +284,7 @@ if __name__ == '__main__':
...
@@ -272,7 +284,7 @@ if __name__ == '__main__':
sim
.
run
(
sim
.
run
(
# debug_mode=True, # 是否调试模式
# debug_mode=True, # 是否调试模式
dt
=
SECONDS_PER_DAY
,
# 1秒=1天
dt
=
SECONDS_PER_DAY
,
# 1秒=1天
# dt=SECONDS_PER_
HOUR, # 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-12-10 12:00:00'
,
# 九(八)星连珠的时间 # https://baijiahao.baidu.com/s?id=1654160345900112362
# show_asteroids=True, # 是否显示小行星带(图片模拟)
# show_asteroids=True, # 是否显示小行星带(图片模拟)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录