feat(app): WASDMove script (WASD camera-relative movement)

ScriptBehavior gains App() host access (Application injected via
ScriptRuntime), TryGet<T> and EntityBits for physics facade addressing.
WASDMove maps WASD to the editor camera's horizontal heading (UE
gameplay convention): dynamic bodies go through the physics velocity
facade preserving the vertical component (zeroing Y would cancel
gravity mid-fall), bodiless entities translate their transform directly.
Editor-mode key conflict is naturally avoided: RMB-held flight consumes
WASD, release hands keys to the script.
This commit is contained in:
2026-10-03 18:27:12 +08:00
parent 3403822a52
commit cad0481bc0
5 changed files with 106 additions and 5 deletions
+3 -2
View File
@@ -103,8 +103,9 @@ namespace Engine {
// 物理调试图元 → 渲染侧(PhysicsDebugPass 每帧上传绘制)
m_Renderer->SetPhysicsDebugSource(&m_Physics->GetDebugFrame());
// 脚本生命周期(对账式,组件增删/改名即时生效)
m_Scripts = CreateScope<Scripting::ScriptRuntime>(*m_Scene);
// 脚本生命周期(对账式,组件增删/改名即时生效);this 注入脚本
// 上下文(Window/Renderer/Physics 门面)
m_Scripts = CreateScope<Scripting::ScriptRuntime>(*m_Scene, this);
while (m_Running) {
const auto frameStart = std::chrono::steady_clock::now();