Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
b6ef713a
宇宙模拟器
项目概览
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看板
提交
b6ef713a
编写于
4月 21, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
a40da510
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
13 deletion
+13
-13
common/system.py
common/system.py
+7
-7
sim_scenes/science/earth_seasons.py
sim_scenes/science/earth_seasons.py
+5
-6
simulators/ursina/entities/entity_utils.py
simulators/ursina/entities/entity_utils.py
+1
-0
未找到文件。
common/system.py
浏览文件 @
b6ef713a
...
...
@@ -165,16 +165,16 @@ class System(object):
return
True
# self.bodies = list(filter(valid_body, self.bodies))
for
body1
in
self
.
bodies
:
if
body1
.
ignore_mass
:
continue
valid_bodies
=
list
(
filter
(
lambda
b
:
not
b
.
ignore_mass
,
self
.
bodies
))
for
body1
in
valid_
bodies
:
#
if body1.ignore_mass:
#
continue
if
not
valid_body
(
body1
):
continue
acceleration
=
np
.
zeros
(
3
)
for
body2
in
self
.
bodies
:
if
body2
.
ignore_mass
:
continue
for
body2
in
valid_
bodies
:
#
if body2.ignore_mass:
#
continue
if
self
.
max_distance
>
0
:
if
calculate_distance
(
body1
.
position
)
>
self
.
max_distance
:
# 超过了max_distance距离,则消失
body1
.
appeared
=
False
...
...
sim_scenes/science/earth_seasons.py
浏览文件 @
b6ef713a
...
...
@@ -8,7 +8,7 @@
# ==============================================================================
from
bodies
import
Sun
,
Earth
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_DAY
,
AU
from
sim_scenes.func
import
ursina_run
from
sim_scenes.func
import
ursina_run
,
camera_look_at
from
simulators.ursina.entities.body_timer
import
TimeData
from
simulators.ursina.ursina_event
import
UrsinaEvent
from
ursina
import
camera
...
...
@@ -77,15 +77,14 @@ if __name__ == '__main__':
"""
for
e
in
[
earth_1
,
earth_2
,
earth_3
,
earth_4
]:
if
term_name
==
e
.
name
:
e
.
planet
.
name_text
.
enabled
=
False
e
.
name_text
.
enabled
=
False
else
:
e
.
planet
.
name_text
.
enabled
=
True
e
.
name_text
.
enabled
=
True
def
on_timer_changed
(
time_data
:
TimeData
):
# 摄像机始终看向移动的地球
camera
.
look_at
(
earth
.
planet
)
camera
.
rotation_z
=
0
camera_look_at
(
earth
,
rotation_z
=
0
)
# 根据角度范围判断,显示中国农历24节气
for
info
in
solar_terms_angles
:
if
info
[
1
]
<=
camera
.
rotation_y
<
info
[
2
]:
...
...
@@ -93,7 +92,7 @@ if __name__ == '__main__':
# 控制4个透明地球文本是否显示,防止地球文字的叠加
earth_text_dispaly
(
term_name
)
# 地球名称文字显示为相应的节气
earth
.
planet
.
name_text
.
text
=
term_name
earth
.
name_text
.
text
=
term_name
# print(camera.rotation_y)
...
...
simulators/ursina/entities/entity_utils.py
浏览文件 @
b6ef713a
...
...
@@ -41,6 +41,7 @@ def create_name_text(parent):
name_text
.
set_light_off
()
name_text
.
color
=
color
.
rgba
(
text_color
[
0
],
text_color
[
1
],
text_color
[
2
],
1
)
parent
.
name_text
=
name_text
parent
.
body
.
name_text
=
name_text
return
name_text
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录