提交 3df3827c 编写于 作者: 三月三net's avatar 三月三net

Python超人-宇宙模拟器

上级 e881265e
......@@ -13,13 +13,15 @@ class CameraTarget(Obj):
"""
摄像机目标
"""
targets = {}
def __init__(self, name="摄像机目标", mass=5.97237e24,
ct_id=None,
init_position=[0, 0, 0],
init_velocity=[0, 0, 0],
texture="", size_scale=1.0, distance_scale=1.0,
ignore_mass=False, density=1e3, color=(7, 0, 162),
trail_color=None, trail_scale_factor=0.2, show_name=False,
trail_color=None, trail_scale_factor=0.2, show_name=True,
parent=None, gravity_only_for=[]):
params = {
"name": name,
......@@ -42,6 +44,19 @@ class CameraTarget(Obj):
super().__init__(**params)
self.set_ignore_gravity(True)
self.set_light_disable(True)
if ct_id is None:
self.ct_id = self.gen_ct_id()
else:
self.ct_id = ct_id
self.targets[self.ct_id] = self
def gen_ct_id(self):
if not hasattr(CameraTarget, "CT_IDX"):
CameraTarget.CT_IDX = 1
else:
CameraTarget.CT_IDX += 1
return CameraTarget.CT_IDX
if __name__ == '__main__':
......
......@@ -58,6 +58,13 @@ class HalleyCometSim(HalleyCometSimBase):
self.bodies.append(self.halley_comet)
# from objs import CameraTarget
#
# self.bodies.append(CameraTarget(size_scale=2e8, init_position=[0, 0, 0], color=(255, 0, 0)))
# self.bodies.append(CameraTarget(size_scale=2e8, init_position=[5 * AU, 0, 0], color=(255, 255, 0)))
# print(CameraTarget.targets)
def init_settings(self):
"""
初始化设置
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册