Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
cd95c3a4
宇宙模拟器
项目概览
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看板
提交
cd95c3a4
编写于
10月 29, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
99675402
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
39 addition
and
7 deletion
+39
-7
sim_scenes/solar_system/halley_comet_sim_02.py
sim_scenes/solar_system/halley_comet_sim_02.py
+4
-2
simulators/ursina/entities/entity_utils.py
simulators/ursina/entities/entity_utils.py
+33
-3
simulators/ursina/ursina_config.py
simulators/ursina/ursina_config.py
+2
-2
未找到文件。
sim_scenes/solar_system/halley_comet_sim_02.py
浏览文件 @
cd95c3a4
...
@@ -117,8 +117,10 @@ class HalleyCometSim:
...
@@ -117,8 +117,10 @@ class HalleyCometSim:
@return:
@return:
"""
"""
# 创建天空
# 创建天空
UrsinaConfig
.
trail_type
=
"line"
# UrsinaConfig.trail_type = "line"
UrsinaConfig
.
trail_length
=
91
# UrsinaConfig.trail_length = 91
UrsinaConfig
.
trail_type
=
"curve_line"
UrsinaConfig
.
trail_length
=
420
# UrsinaConfig.trail_length = 1000
# UrsinaConfig.trail_length = 1000
UrsinaConfig
.
trail_thickness_factor
=
3
UrsinaConfig
.
trail_thickness_factor
=
3
# camera.clip_plane_near = 0.1
# camera.clip_plane_near = 0.1
...
...
simulators/ursina/entities/entity_utils.py
浏览文件 @
cd95c3a4
...
@@ -118,12 +118,20 @@ def create_trails(parent):
...
@@ -118,12 +118,20 @@ def create_trails(parent):
# # 如果拖尾在天体的内部也不要生成
# # 如果拖尾在天体的内部也不要生成
# if self_pos_distance < self.scale_x + (self.trail_scale / 2):
# if self_pos_distance < self.scale_x + (self.trail_scale / 2):
# pass
# pass
if
UrsinaConfig
.
trail_type
==
"curve_line"
:
# 如果位置比较近,就不创建拖尾了,保证拖尾间隔一定的距离
# if last_pos_distance < parent.trail_scale * trail_int_scale / 5:
if
last_pos_distance
<
10
:
return
else
:
# 如果位置比较近,就不创建拖尾了,保证拖尾间隔一定的距离
# 如果位置比较近,就不创建拖尾了,保证拖尾间隔一定的距离
if
last_pos_distance
<
parent
.
trail_scale
*
trail_int_scale
:
# 间隔距离不小于1.2倍的拖尾球体
if
last_pos_distance
<
parent
.
trail_scale
*
trail_int_scale
:
# 间隔距离不小于1.2倍的拖尾球体
return
return
if
UrsinaConfig
.
trail_type
==
"line"
:
if
UrsinaConfig
.
trail_type
==
"line"
:
trail
=
create_trail_line
(
parent
,
pos
)
# 拖尾为线条
trail
=
create_trail_line
(
parent
,
pos
)
# 拖尾为线条
elif
UrsinaConfig
.
trail_type
==
"curve_line"
:
trail
=
create_trail_curve_line
(
parent
,
pos
)
# 拖尾为曲线条
else
:
else
:
trail
=
create_trail_sphere
(
parent
,
pos
)
# 拖尾为球体
trail
=
create_trail_sphere
(
parent
,
pos
)
# 拖尾为球体
...
@@ -247,6 +255,28 @@ def create_trail_line(parent, pos):
...
@@ -247,6 +255,28 @@ def create_trail_line(parent, pos):
return
trail
return
trail
def
create_trail_curve_line
(
parent
,
pos
):
"""
在天体当前的位置创建一个拖尾球体
@param pos:
@return:
"""
trail
=
None
if
hasattr
(
parent
,
"trail_last_pos"
):
trail_last_pos
=
parent
.
trail_last_pos
if
distance
(
pos
,
trail_last_pos
)
>
0
:
trail
=
Entity
(
model
=
Mesh
(
vertices
=
((
pos
[
0
],
pos
[
1
],
pos
[
2
]),
(
trail_last_pos
[
0
],
trail_last_pos
[
1
],
trail_last_pos
[
2
])),
mode
=
'line'
,
thickness
=
UrsinaConfig
.
trail_thickness_factor
),
color
=
parent
.
trail_color
,
alpha
=
0.5
)
trail
.
set_light_off
()
parent
.
last_trail
=
trail
parent
.
trail_last_pos
=
pos
return
trail
def
create_rings
(
parent
):
def
create_rings
(
parent
):
"""
"""
创建行星环(使用土星贴图)
创建行星环(使用土星贴图)
...
...
simulators/ursina/ursina_config.py
浏览文件 @
cd95c3a4
...
@@ -42,8 +42,8 @@ class UrsinaConfig:
...
@@ -42,8 +42,8 @@ class UrsinaConfig:
# 拖尾球体的数量
# 拖尾球体的数量
trail_length
=
100
trail_length
=
100
# 拖尾的类型(球体、线条)
# 拖尾的类型(球体、线条
、曲线条
)
trail_type
=
"sphere"
#
trail_type="line" or trail_type="sphere"
trail_type
=
"sphere"
#
line sphere curve_line
# 默认秒数(0表示默认)
# 默认秒数(0表示默认)
seconds_per
=
0
seconds_per
=
0
# # 控制摄像机动作速度(天体越大,速度越快,天体越小,速度越慢)
# # 控制摄像机动作速度(天体越大,速度越快,天体越小,速度越慢)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录