Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
a4bdd56e
宇宙模拟器
项目概览
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看板
提交
a4bdd56e
编写于
10月 06, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
0acaae52
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
80 addition
and
0 deletion
+80
-0
objs/__init__.py
objs/__init__.py
+1
-0
sim_scenes/fiction/show_all_objs.py
sim_scenes/fiction/show_all_objs.py
+79
-0
未找到文件。
objs/__init__.py
浏览文件 @
a4bdd56e
...
@@ -9,3 +9,4 @@ from objs.rock import Rock, create_rock
...
@@ -9,3 +9,4 @@ from objs.rock import Rock, create_rock
from
objs.core_valaga_clas
import
CoreValagaClas
from
objs.core_valaga_clas
import
CoreValagaClas
from
objs.sci_fi_bomber
import
SciFiBomber
from
objs.sci_fi_bomber
import
SciFiBomber
from
objs.water_drop
import
WaterDrop
from
objs.water_drop
import
WaterDrop
from
objs.sci_fi_gunship
import
ScifiGunship
sim_scenes/fiction/show_all_objs.py
0 → 100644
浏览文件 @
a4bdd56e
# -*- coding:utf-8 -*-
# title :显示所有的三维物体
# description :显示所有的三维物体
# author :Python超人
# date :2023-10-06
# link :https://gitcode.net/pythoncr/
# python_version :3.9
# ==============================================================================
import
random
from
objs
import
*
from
common.consts
import
SECONDS_PER_DAY
from
sim_scenes.func
import
ursina_run
def
create_rock
(
no
:
int
=
None
,
**
kwargs
):
if
no
is
not
None
:
kwargs
[
"model"
]
=
f
"rock
{
no
}
.obj"
kwargs
[
"texture"
]
=
f
"rock
{
no
}
.png"
rock
=
Rock
(
ignore_mass
=
True
,
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
20000
,
**
kwargs
)
return
rock
# 对距离整体进行调整
r
=
60000
objs
=
[]
for
i
in
range
(
8
):
rock
=
create_rock
(
no
=
i
%
8
+
1
,
name
=
f
'岩石
{
i
+
1
}
'
)
objs
.
append
(
rock
)
objs
+=
[
Diamond
(
ignore_mass
=
True
,
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
12000
),
# 钻石
Football
(
ignore_mass
=
True
,
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
20000
),
# 足球
# Rock(ignore_mass=True, init_velocity=[0, 0, 0],size_scale= 20000), # 岩石
# RockSnow(ignore_mass=True, init_velocity=[0, 0, 0],size_scale= 20000), # 带雪的岩石
Satellite
(
ignore_mass
=
True
,
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
5000
),
# 卫星
Satellite2
(
ignore_mass
=
True
,
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
5000
),
# 卫星2
SciFiBomber
(
ignore_mass
=
True
,
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
5
),
# 飞船
ScifiGunship
(
ignore_mass
=
True
,
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
100
),
# 飞船
SpaceShip
(
ignore_mass
=
True
,
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
20000
),
# 太空飞船
StarWarsSpeeder
(
ignore_mass
=
True
,
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
200
),
# 太空战机
WaterDrop
(
ignore_mass
=
True
,
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
20000
),
# 水滴
]
def
get_objs
():
new_objs
=
[]
obj_idx
=
0
for
x
in
range
(
-
2
,
2
):
for
y
in
range
(
0
,
1
):
for
z
in
range
(
-
2
,
3
):
if
obj_idx
>
len
(
objs
)
-
1
:
return
new_objs
obj
=
objs
[
obj_idx
]
obj_idx
+=
1
if
isinstance
(
obj
,
StarWarsSpeeder
):
obj
.
init_position
=
[
r
*
x
*
2
,
r
*
y
,
r
*
z
+
50000
]
else
:
obj
.
init_position
=
[
r
*
x
*
2
,
r
*
y
,
r
*
z
]
new_objs
.
append
(
obj
)
return
new_objs
if
__name__
==
'__main__'
:
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
get_objs
(),
SECONDS_PER_DAY
,
position
=
(
0
,
0
,
-
r
*
10
),
show_camera_info
=
False
,
show_control_info
=
False
,
show_grid
=
False
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录