修复 PIE 快照丢相机组件(序列化写出键 Attached ≠ 读侧 Camera)与子弹同帧多接触重复特效(Bullet 命中防重入)
This commit is contained in:
@@ -81,6 +81,12 @@ namespace {
|
|||||||
|
|
||||||
void OnCollisionEnter(u32 other, const glm::vec3& point,
|
void OnCollisionEnter(u32 other, const glm::vec3& point,
|
||||||
const glm::vec3& normal) override {
|
const glm::vec3& normal) override {
|
||||||
|
// 防重入:Destroy 是帧尾延迟执行,命中帧内子弹与碎片群
|
||||||
|
// 可产生多对接触事件(碎片云一块挨一块),无标志会一帧
|
||||||
|
// 爆出 N 个特效(同 WallFracture m_Fired 的一次性触发模式)
|
||||||
|
if (m_Hit) return;
|
||||||
|
m_Hit = true;
|
||||||
|
|
||||||
(void)other; (void)normal; // 法线留给将来定向溅射
|
(void)other; (void)normal; // 法线留给将来定向溅射
|
||||||
|
|
||||||
// 命中特效:空实体锚在命中点,ImpactFx 脚本项由下一帧对账
|
// 命中特效:空实体锚在命中点,ImpactFx 脚本项由下一帧对账
|
||||||
@@ -101,6 +107,7 @@ namespace {
|
|||||||
glm::vec3 m_Velocity{0.0f};
|
glm::vec3 m_Velocity{0.0f};
|
||||||
f32 m_Lifetime = 5.0f;
|
f32 m_Lifetime = 5.0f;
|
||||||
f32 m_Age = 0.0f;
|
f32 m_Age = 0.0f;
|
||||||
|
bool m_Hit = false; // 首次命中置位(防同帧多次接触重复特效)
|
||||||
};
|
};
|
||||||
|
|
||||||
// ---- 命中特效脚本(Bullet 运行时挂载;空实体 + 调试点标占位)----
|
// ---- 命中特效脚本(Bullet 运行时挂载;空实体 + 调试点标占位)----
|
||||||
|
|||||||
@@ -440,7 +440,10 @@ namespace Engine::Serialization {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (const auto* c = reg.try_get<ECS::CameraComponent>(e)) {
|
if (const auto* c = reg.try_get<ECS::CameraComponent>(e)) {
|
||||||
out << YAML::Key << "Attached" << YAML::Value
|
// 键名 = "Camera"(与读侧 731 行对称;曾误写 "Attached"
|
||||||
|
// 导致 PIE 快照恢复丢相机组件——磁盘场景手写 YAML 键名
|
||||||
|
// Camera 才一直没暴露)
|
||||||
|
out << YAML::Key << "Camera" << YAML::Value
|
||||||
<< YAML::BeginMap;
|
<< YAML::BeginMap;
|
||||||
out << YAML::Key << "Primary" << YAML::Value << c->primary;
|
out << YAML::Key << "Primary" << YAML::Value << c->primary;
|
||||||
out << YAML::Key << "Active" << YAML::Value << c->active;
|
out << YAML::Key << "Active" << YAML::Value << c->active;
|
||||||
|
|||||||
Reference in New Issue
Block a user