refactor(physics): rename isSensor to isTrigger (Unity/UE terminology)

UE calls it Trigger (Overlap Events / Trigger preset) and Unity's UI
says "Is Trigger"; "sensor" is the physics-backend term (Jolt sensor,
Box2D sensor). Rename the component/record flag and the Inspector
label. Scene files now persist "IsTrigger" with backward-compatible
read of the old "IsSensor" key.
This commit is contained in:
2026-10-03 18:53:38 +08:00
parent b6d0868e15
commit 29c413579d
5 changed files with 12 additions and 9 deletions
+4 -2
View File
@@ -306,7 +306,7 @@ namespace Engine::Serialization {
out << YAML::Key << "Friction" << YAML::Value << rb->friction;
out << YAML::Key << "Restitution" << YAML::Value
<< rb->restitution;
out << YAML::Key << "IsSensor" << YAML::Value << rb->isSensor;
out << YAML::Key << "IsTrigger" << YAML::Value << rb->isTrigger;
// bodyId/bodyValid/velocity 由 PhysicsWorld 对账重建,不存
out << YAML::Key << "Active" << YAML::Value << rb->active;
out << YAML::EndMap;
@@ -616,7 +616,9 @@ namespace Engine::Serialization {
rb.gravityScale = n["GravityScale"].as<f32>(rb.gravityScale);
rb.friction = n["Friction"].as<f32>(rb.friction);
rb.restitution = n["Restitution"].as<f32>(rb.restitution);
rb.isSensor = n["IsSensor"].as<bool>(rb.isSensor);
// 新键 IsTrigger;旧场景 IsSensor 兼容读(缺键 as 返回 fallback 安全)
rb.isTrigger = n["IsTrigger"].as<bool>(
n["IsSensor"].as<bool>(rb.isTrigger));
rb.active = n["Active"].as<bool>(true);
// bodyId/bodyValid/velocity 保持默认(对账重建)
}