fix(physics): editor drag teleports dynamic bodies

SyncScene only reconciled static/kinematic transforms into Jolt bodies;
dragging a dynamic entity (esp. while paused, where Writeback never runs)
moved the visual but left the body -- and the collider debug wireframe --
at the old pose. Dynamic bodies now get the same drag reconciliation
(teleport + zero velocity + activate), and Writeback syncs
lastPos/lastRot to the body pose so physics motion is never misread as
editor dragging (which would teleport the body back).
This commit is contained in:
2026-10-03 17:51:11 +08:00
parent d5a86c170e
commit ea6beee593
2 changed files with 26 additions and 2 deletions
+1 -1
View File
@@ -119,7 +119,7 @@ namespace Engine {
};
void SyncScene(); // 对账:孤儿清理 / 创建 / 参数同步
void Writeback() const; // 动态体 → TransformComponent(标脏)
void Writeback(); // 动态体 → TransformComponent(标脏)+ lastPos/lastRot 对账基线
void UpdateAccels(f32 dt); // 速度差分 → BodyRecord.lastAccel(step 率)
void CollectDebugData(); // 按 m_DebugBits 收集调试图元(渲染帧率)
void CreateBody(u32 entityBits, ECS::RigidBodyComponent& rb,