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
+3 -3
View File
@@ -390,7 +390,7 @@ namespace Engine {
rec.halfHeight != halfHeight ||
rec.compound != rb.compound ||
rec.mass != rb.mass ||
rec.isSensor != rb.isSensor) {
rec.isTrigger != rb.isTrigger) {
// 类型/碰撞体/质量变更 → 重建(简单正确,重置速度可接受)
bi.RemoveBody(rec.id);
bi.DestroyBody(rec.id);
@@ -860,7 +860,7 @@ namespace Engine {
settings.mFriction = rb.friction;
settings.mRestitution = rb.restitution;
settings.mUserData = entityBits; // 事件回调:Body → 实体位模式反查
settings.mIsSensor = rb.isSensor; // 传感器:只收 Added/Removed,不解算
settings.mIsSensor = rb.isTrigger; // 触发器:只收 Added/Removed,不解算
const JPH::BodyID id = bi.CreateAndAddBody(
settings, dynamic ? JPH::EActivation::Activate : JPH::EActivation::DontActivate);
@@ -873,7 +873,7 @@ namespace Engine {
ExtractShapeParams(rb, rec.radius, rec.halfHeight);
rec.compound = rb.compound;
rec.mass = rb.mass;
rec.isSensor = rb.isSensor;
rec.isTrigger = rb.isTrigger;
rec.lastPos = tr.GetPosition();
rec.lastRot = tr.GetRotationQuat();
m_Bodies[entityBits] = rec;