Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
太阳系三体模拟器
提交
56260282
太阳系三体模拟器
项目概览
Python_超人
/
太阳系三体模拟器
通知
1075
Star
131
Fork
128
代码
文件
提交
分支
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看板
提交
56260282
编写于
3月 10, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
太阳系三体模拟器
上级
ace0ebc2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
5 deletion
+36
-5
simulators/views/ursina_view.py
simulators/views/ursina_view.py
+36
-5
未找到文件。
simulators/views/ursina_view.py
浏览文件 @
56260282
...
@@ -28,6 +28,27 @@ import matplotlib.pyplot as plt
...
@@ -28,6 +28,27 @@ import matplotlib.pyplot as plt
SCALE_FACTOR
=
1e-6
SCALE_FACTOR
=
1e-6
class
Ring
(
Entity
):
def
__init__
(
self
,
thickness
=
0.2
,
inner_radius
=
0.5
,
outer_radius
=
3
,
texture
=
None
,
position
=
None
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
inner_circle
=
Entity
(
parent
=
self
,
model
=
'circle'
,
texture
=
texture
,
scale
=
inner_radius
,
position
=
position
)
outer_circle
=
Entity
(
parent
=
self
,
model
=
'circle'
,
texture
=
texture
,
scale
=
outer_radius
,
position
=
position
)
self
.
children
.
append
(
inner_circle
)
self
.
children
.
append
(
outer_circle
)
inner_circle
.
parent
=
self
outer_circle
.
parent
=
self
inner_circle
.
set_light_off
()
outer_circle
.
set_light_off
()
# inner_circle.y += thickness / 2
# outer_circle.y -= thickness / 2
# self.scale_y = thickness
# 创建 TorusMesh
# 创建 TorusMesh
class
TorusMesh
(
Mesh
):
class
TorusMesh
(
Mesh
):
def
__init__
(
self
,
radius
=
1
,
thickness
=
.
25
,
radial_segments
=
16
,
tubular_segments
=
32
):
def
__init__
(
self
,
radius
=
1
,
thickness
=
.
25
,
radial_segments
=
16
,
tubular_segments
=
32
):
...
@@ -286,16 +307,26 @@ class UrsinaView(BodyView):
...
@@ -286,16 +307,26 @@ class UrsinaView(BodyView):
self
.
planet
.
set_light_off
()
self
.
planet
.
set_light_off
()
def
create_rings
(
self
):
def
create_rings
(
self
):
ring
=
Entity
(
model
=
'torus'
,
texture
=
'textures/saturnRings.jpg'
,
scale
=
(
4
,
4
),
double_sided
=
True
)
from
ursina
import
Cylinder
scale
=
3
*
self
.
body
.
diameter
*
self
.
body
.
size_scale
*
SCALE_FACTOR
# ring = Entity(model=TorusMesh(radius=self.body.diameter * 100, thickness=.5), texture='textures/saturnRings.jpg', scale=3)
pos
=
self
.
planet
.
position
ring
.
world_parent
=
self
.
planet
# self.ring = Entity(model='sphere', texture='textures/saturnRings.jpg', scale=scale, position=pos,double_sided=True)
ring
.
position
=
self
.
planet
.
position
self
.
ring
=
Entity
(
model
=
"circle"
,
texture
=
'../textures/saturnRings.jpg'
,
scale
=
scale
,
position
=
pos
,
rotation
=
(
70
,
0
,
0
),
double_sided
=
True
)
# self.ring2 = Entity(model="circle", texture='../textures/saturnRings.jpg', scale=scale, position=pos,
# rotation=(180 + 70, 0, 0))
self
.
ring
.
set_light_off
()
# self.ring2.set_light_off()
def
update
(
self
):
def
update
(
self
):
self
.
planet
.
turn
()
self
.
planet
.
turn
()
if
hasattr
(
self
,
"light"
):
if
hasattr
(
self
,
"light"
):
self
.
light
.
position
=
Vec3
(
self
.
planet
.
x
,
self
.
planet
.
y
,
self
.
planet
.
z
)
self
.
light
.
position
=
Vec3
(
self
.
planet
.
x
,
self
.
planet
.
y
,
self
.
planet
.
z
)
if
hasattr
(
self
,
"ring"
):
self
.
ring
.
position
=
Vec3
(
self
.
planet
.
x
,
self
.
planet
.
y
,
self
.
planet
.
z
)
# if hasattr(self, "ring2"):
# self.ring2.position = Vec3(self.planet.x, self.planet.y, self.planet.z)
def
appear
(
self
):
def
appear
(
self
):
pass
pass
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录