From d4d37b4b28de4b8871112d7aea587e9eb849e93a Mon Sep 17 00:00:00 2001 From: atdunbg Date: Thu, 8 Oct 2026 23:06:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20PIE=20=E5=BF=AB=E7=85=A7?= =?UTF-8?q?=E4=B8=A2=E7=9B=B8=E6=9C=BA=E7=BB=84=E4=BB=B6=EF=BC=88=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96=E5=86=99=E5=87=BA=E9=94=AE=20Attached=20?= =?UTF-8?q?=E2=89=A0=20=E8=AF=BB=E4=BE=A7=20Camera=EF=BC=89=E4=B8=8E?= =?UTF-8?q?=E5=AD=90=E5=BC=B9=E5=90=8C=E5=B8=A7=E5=A4=9A=E6=8E=A5=E8=A7=A6?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=89=B9=E6=95=88=EF=BC=88Bullet=20=E5=91=BD?= =?UTF-8?q?=E4=B8=AD=E9=98=B2=E9=87=8D=E5=85=A5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/scripts/TestShoot.cpp | 7 +++++++ Engine/src/Serialization/SceneSerializer.cpp | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/App/scripts/TestShoot.cpp b/App/scripts/TestShoot.cpp index f67c5a8..767157a 100644 --- a/App/scripts/TestShoot.cpp +++ b/App/scripts/TestShoot.cpp @@ -81,6 +81,12 @@ namespace { void OnCollisionEnter(u32 other, const glm::vec3& point, const glm::vec3& normal) override { + // 防重入:Destroy 是帧尾延迟执行,命中帧内子弹与碎片群 + // 可产生多对接触事件(碎片云一块挨一块),无标志会一帧 + // 爆出 N 个特效(同 WallFracture m_Fired 的一次性触发模式) + if (m_Hit) return; + m_Hit = true; + (void)other; (void)normal; // 法线留给将来定向溅射 // 命中特效:空实体锚在命中点,ImpactFx 脚本项由下一帧对账 @@ -101,6 +107,7 @@ namespace { glm::vec3 m_Velocity{0.0f}; f32 m_Lifetime = 5.0f; f32 m_Age = 0.0f; + bool m_Hit = false; // 首次命中置位(防同帧多次接触重复特效) }; // ---- 命中特效脚本(Bullet 运行时挂载;空实体 + 调试点标占位)---- diff --git a/Engine/src/Serialization/SceneSerializer.cpp b/Engine/src/Serialization/SceneSerializer.cpp index d8c050c..a81115a 100644 --- a/Engine/src/Serialization/SceneSerializer.cpp +++ b/Engine/src/Serialization/SceneSerializer.cpp @@ -440,7 +440,10 @@ namespace Engine::Serialization { } if (const auto* c = reg.try_get(e)) { - out << YAML::Key << "Attached" << YAML::Value + // 键名 = "Camera"(与读侧 731 行对称;曾误写 "Attached" + // 导致 PIE 快照恢复丢相机组件——磁盘场景手写 YAML 键名 + // Camera 才一直没暴露) + out << YAML::Key << "Camera" << YAML::Value << YAML::BeginMap; out << YAML::Key << "Primary" << YAML::Value << c->primary; out << YAML::Key << "Active" << YAML::Value << c->active;