camera: UE Scene-view semantics — RMB fly, MMB focus-orbit, wheel dolly, F focus

Key conflict fix (UE semantics): while RMB is held the keyboard belongs
to the camera, so WASD no longer collides with the gizmo W/E/R tool
hotkeys. Editor mode gates fly movement behind RMB; game mode keeps
always-on WASD. Viewport tool hotkeys (W/E/R/T/F) are suppressed while
RMB is held.

Focus orbit (pivot): MMB drag rotates the camera around a pivot keeping
distance; first orbit picks a pivot 5m ahead on the view ray. Shift+MMB
pans in screen plane (camera and pivot move together). Mouse wheel
dollies toward/away from the pivot with exponential steps (no pivot:
move along view ray). F focuses the selected entity (frame-selection):
pivot set to its position, camera slides along the view ray; orbit
distance persists.

Window gains a polled scroll-delta channel (ConsumeScrollDelta) that
respects ImGui mouse capture; Camera::Update mutates orbit state (no
longer const).
This commit is contained in:
2026-10-03 13:02:55 +08:00
parent 9ff08651f0
commit ffe33e9967
6 changed files with 178 additions and 45 deletions
+6 -3
View File
@@ -201,12 +201,15 @@ namespace
void OnUpdate(const FrameTime& frameTime) override
{
// 相机(WASD/Space/Shift 移动;位姿读写实体 Transform)。
// 编辑器相机走真实轨:暂停(timeScale=0)时仍可飞行观察
// 相机(RMB 飞行 / MMB 焦点环绕 / 滚轮推拉;位姿读写实体
// Transform)。编辑器相机走真实轨:暂停(timeScale=0)时仍
// 可飞行观察。编辑器模式移动键需 RMB 按住(UE 语义:飞行时
// 键盘归相机,W/E/R 归 Gizmo)
m_Camera.GetComponent<CameraComponent>()
.camera.Update(GetWindow(),
m_Camera.GetComponent<TransformComponent>(),
frameTime.UnscaledDt());
frameTime.UnscaledDt(),
GetRenderer().GetDisplayMode() == kDisplayViewport);
// 旋转动画:编辑 Transform 分量后 Compose 重算 world。
// 动画时钟 = Time::Elapsed()(scaled 累计,暂停自动冻结——