Multi-mode camera with HUD and C key cycling#3
Open
gitdolucas wants to merge 2 commits intomrdoob:masterfrom
Open
Multi-mode camera with HUD and C key cycling#3gitdolucas wants to merge 2 commits intomrdoob:masterfrom
gitdolucas wants to merge 2 commits intomrdoob:masterfrom
Conversation
- Cycle eagle / third / hood on Key C (edge-detected in Controls) - Smooth transitions with per-edge durations; third uses vehicle yaw chase - Third→hood two-phase path (roof approach); fix lookAt via real PerspectiveCamera - Speed-based FOV in third and hood; hood barrel roll from steering × speed - Vehicle: lateral velocity derivative (optional); pass full vehicle to Camera Co-authored-by: Cursor <cursoragent@cursor.com>
- CameraHud: Switch button (camera icon + label), mode list with active styling - Position below #lap-timer when present; Camera.getHudMode() for highlight sync - Wire HUD in main loop with same advanceMode callback as Key C Co-authored-by: Cursor <cursoragent@cursor.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds three camera modes (Eagle, third-person, and hood) with smoothed transitions between them, optional speed-based FOV widening, and hood-view roll tied to lateral acceleration. Includes a small HUD under the lap timer listing modes and a Switch control (same as C / gamepad equivalent).
Changes
js/Camera.js—CAMERA_MODEenum; per-mode placement (orbital eagle, chase, hood); smootherstep transitions with mode-pair-specific durations; FOV boost at speed; hood barrel roll from vehicle lateral accel;advanceMode()/getHudMode()for cycling and UI.js/CameraHud.js(new) — DOM overlay: Switch button + mode list; positioned below#lap-timeron resize; updates active state from camera.js/main.js— WireCameraHud, calladvanceModeoncycleCamera,cameraHud.update(cam)each frame.js/Controls.js— ExposecycleCameraon C edge (keyboard / existing gamepad path).js/Vehicle.js— TracklateralAccel(world-space along car right, XZ) for cockpit roll.How to test
Notes
#lap-timeris missing it falls back totop: 12px.