Skip to content

DRAFT Fix vehicle exit shake#143

Draft
AJBats wants to merge 2 commits into
LivingFray:masterfrom
AJBats:fix-vehicle-shake
Draft

DRAFT Fix vehicle exit shake#143
AJBats wants to merge 2 commits into
LivingFray:masterfrom
AJBats:fix-vehicle-shake

Conversation

@AJBats
Copy link
Copy Markdown
Contributor

@AJBats AJBats commented Feb 1, 2026

This is just a draft of a fix for the vehicle exit shake bug. I'm putting it up in an unfinished draft state because i want to get in front of maintaner's eyes sooner rather than later to get their take on it. For full transparency, this was coded with assistance from Claude Opus 4.5, and I don't fully understand the fix here, though Claude has walked me through it and it makes sense to me. So please consider this when reviewing.

Summary

  • Suppress the diverging camera oscillation ("earthquake") that occurs when exiting vehicles by zeroing HMD yaw/pitch delta corrections during the exit transition, then syncing the camera reference to the HMD direction on cooldown expiry
  • Smooth the abrupt camera position jump from third-person to first-person with an exponential moving average
  • Add opt-in diagnostic CSV logger (F6 toggle) for capturing per-frame camera/position/frustum data around vehicle transitions

Problem
When exiting a vehicle, InputHandler::UpdateCamera() computes yaw = atan2(lookHMD) - atan2(lookGame). Because lookGame still points in the vehicle's facing direction while lookHMD points where the player's head is, this produces a large delta that overshoots. Each subsequent frame overcorrects in the opposite direction, creating a diverging feedback loop visible as violent camera shake. This was confirmed by diagnostic CSV captures showing yawGame oscillating with growing magnitude while yawHMD remained steady.

Vehicle enter is unaffected because vehicle mode uses UpdateCameraForVehicles() (joystick-based), which doesn't compute HMD deltas.

Fix
Rotation (UpdateCamera): Zero yaw/pitch deltas for 90 frames (~1s) after vehicle exit so the game's native camera transition runs without VR correction interference. On cooldown expiry, sync LastLookDir and lookDir to the current HMD direction so tracking resumes with near-zero delta.

Position (PreDrawFrame): EMA smooth the camera position (alpha=0.04) from the vehicle camera to first-person, disabling automatically when converged.

Testing
I've only tested a single scenario so far. I'm going to keep testing.

@AJBats AJBats force-pushed the fix-vehicle-shake branch from 87bf818 to 0912708 Compare February 1, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant