From 3678543d7970e3281815b7adfcb9e8de14697755 Mon Sep 17 00:00:00 2001 From: march3 Date: Mon, 13 Nov 2023 16:11:40 +0800 Subject: [PATCH] =?UTF-8?q?Python=E8=B6=85=E4=BA=BA-=E5=AE=87=E5=AE=99?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- objs/halley_comet.py | 2 +- sim_scenes/solar_system/halley_comet_sim.py | 6 +++--- simulators/ursina/entities/planet.py | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/objs/halley_comet.py b/objs/halley_comet.py index 8d90b6b..35acf12 100644 --- a/objs/halley_comet.py +++ b/objs/halley_comet.py @@ -50,7 +50,7 @@ class HalleComet(RockSnow): super().__init__(**params) # create_cone(radius, height, subdivisions, r=0.1) # self.comet_info = (0.18, 2.0, 100, 0.2) - self.comet_info = (0.03, 0.18, 2, 100) + self.comet_info = (0.05, 0.18, 2, 100) from ursina.prefabs.primitives import Shader diff --git a/sim_scenes/solar_system/halley_comet_sim.py b/sim_scenes/solar_system/halley_comet_sim.py index 375e170..1b16989 100644 --- a/sim_scenes/solar_system/halley_comet_sim.py +++ b/sim_scenes/solar_system/halley_comet_sim.py @@ -155,7 +155,7 @@ class HalleyCometSim(HalleyCometSimBase): # 渐渐消失的距离范围(开始消失距离, 完全消失距离) HIDE_DISTANCE = 3, 12 # 彗星最大的透明度 - MAX_ALPHA = 1 + MAX_ALPHA = 0.8 # 大于完全消失距离 if d_au >= HIDE_DISTANCE[1]: @@ -165,8 +165,8 @@ class HalleyCometSim(HalleyCometSimBase): else: alpha = MAX_ALPHA # 修改彗星尾巴的透明度 - c = self.halley_comet.planet.comet_trail - c.alpha = alpha + self.halley_comet.planet.comet_trail.alpha = alpha + self.halley_comet.planet.comet_sphere.alpha = alpha def show_milestone_lable(self, last_trail, dt): """ diff --git a/simulators/ursina/entities/planet.py b/simulators/ursina/entities/planet.py index 5743279..d2e8345 100644 --- a/simulators/ursina/entities/planet.py +++ b/simulators/ursina/entities/planet.py @@ -188,8 +188,11 @@ class Planet(Entity): position=(0, 0, 0), rotation=(0, 90, 90), double_sided=True, alpha=0.8) + self.comet_sphere = Entity(parent=self, model="sphere", texture="", + color=color.white, scale=2.2, double_sided=True, alpha=0.6) # 设置行星环不受灯光影响,否则看不清行星环 self.comet_trail.set_light_off() + self.comet_sphere.set_light_off() def create_rotate_entity(self): """ -- GitLab