# -*- coding:utf-8 -*- # title :摄像机目标 # description :摄像机目标 # author :Python超人 # date :2023-11-10 # link :https://gitcode.net/pythoncr/ # python_version :3.9 # ============================================================================== from objs.obj import Obj 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=True, parent=None, gravity_only_for=[]): params = { "name": name, "mass": mass, "init_position": init_position, "init_velocity": init_velocity, "density": density, "color": color, "texture": texture, "size_scale": size_scale, "distance_scale": distance_scale, "ignore_mass": ignore_mass, "trail_color": trail_color, "trail_scale_factor": trail_scale_factor, "show_name": show_name, "parent": parent, "gravity_only_for": gravity_only_for, "model": "sphere" } 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__': camera_target = CameraTarget() print(camera_target) camera_target.show_demo(size_scale=1000000)