Skip to content

Implement flycam - #19

Merged
nixonyh merged 2 commits into
mainfrom
feature/flycam
Jun 5, 2026
Merged

Implement flycam#19
nixonyh merged 2 commits into
mainfrom
feature/flycam

Conversation

@mrclputra

Copy link
Copy Markdown
Contributor

Swapped out rotating table for a simple WASDQE flycam.
Code should be much easier to look at :)

@mrclputra
mrclputra requested a review from nixonyh as a code owner June 5, 2026 02:14
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f3dc9582-5f3e-46fe-96ff-719d1fb9d44f

📥 Commits

Reviewing files that changed from the base of the PR and between c9d2317 and 17756df.

📒 Files selected for processing (1)
  • src/camera.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/camera.rs

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Replaced the camera system with a flycam controller: move with WASD, ascend/descend with Q/E, and rotate using right-click + drag. Mouse motion only applies while right button is held; pitch is clamped to prevent extreme angles.

Walkthrough

The PR replaces a trackball camera controller with a flycam. The CameraController struct now holds speed, sensitivity, yaw, and pitch. update_camera reads mouse motion for right-button look (clamped pitch), sets rotation via quaternion from yaw/pitch, and applies time-scaled WASD+QE local-space translation.

Changes

Flycam Camera Controller

Layer / File(s) Summary
Flycam controller struct and update logic
src/camera.rs
CameraController struct redefined from trackball model to flycam model with speed, sensitivity, yaw, pitch fields. update_camera rewritten to apply time-scaled WASD+QE translation in local space and right-mouse-drag yaw/pitch rotation with quaternion-based orientation and pitch clamping.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 The old trackball rolls aside,
A nimble flycam takes the ride.
With yaw and pitch, we turn our eyes,
WASD lifts us toward the skies.
Quaternions hum — the world feels wide.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Implement flycam' directly and concisely describes the main change: replacing the trackball camera with a flycam controller.
Description check ✅ Passed The description explains the core change (swapping trackball for WASDQE flycam) and its intent (easier to read), which relates to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/camera.rs (1)

69-74: 💤 Low value

Consider reformatting for readability.

The movement logic is correct, but the lines are quite long. Consider breaking them into multiple lines for improved readability.

📝 Optional formatting improvement
-    if keyboard.pressed(KeyCode::KeyW) { transform.translation += *forward * speed; }
-    if keyboard.pressed(KeyCode::KeyS) { transform.translation -= *forward * speed; }
-    if keyboard.pressed(KeyCode::KeyD) { transform.translation += *right * speed; }
-    if keyboard.pressed(KeyCode::KeyA) { transform.translation -= *right * speed; }
-    if keyboard.pressed(KeyCode::KeyE) { transform.translation += up * speed; }
-    if keyboard.pressed(KeyCode::KeyQ) { transform.translation -= up * speed; }
+    if keyboard.pressed(KeyCode::KeyW) {
+        transform.translation += *forward * speed;
+    }
+    if keyboard.pressed(KeyCode::KeyS) {
+        transform.translation -= *forward * speed;
+    }
+    if keyboard.pressed(KeyCode::KeyD) {
+        transform.translation += *right * speed;
+    }
+    if keyboard.pressed(KeyCode::KeyA) {
+        transform.translation -= *right * speed;
+    }
+    if keyboard.pressed(KeyCode::KeyE) {
+        transform.translation += up * speed;
+    }
+    if keyboard.pressed(KeyCode::KeyQ) {
+        transform.translation -= up * speed;
+    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/camera.rs` around lines 69 - 74, The movement input lines in camera.rs
are correct but too long and hurt readability; refactor the repeated single-line
statements (those using keyboard.pressed(KeyCode::KeyW/KeyS/KeyD/KeyA/KeyE/KeyQ)
and modifying transform.translation with *forward, *right, up and speed) into
multi-line, clearer forms—for example, extract the direction and delta into a
small local variable (e.g., let delta = direction * speed) or format the if
bodies on their own lines so each statement is short and consistent; update the
blocks that reference transform.translation, forward, right, up,
keyboard.pressed and speed accordingly to keep behavior identical while
improving line length and readability.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/camera.rs`:
- Around line 69-74: The movement input lines in camera.rs are correct but too
long and hurt readability; refactor the repeated single-line statements (those
using keyboard.pressed(KeyCode::KeyW/KeyS/KeyD/KeyA/KeyE/KeyQ) and modifying
transform.translation with *forward, *right, up and speed) into multi-line,
clearer forms—for example, extract the direction and delta into a small local
variable (e.g., let delta = direction * speed) or format the if bodies on their
own lines so each statement is short and consistent; update the blocks that
reference transform.translation, forward, right, up, keyboard.pressed and speed
accordingly to keep behavior identical while improving line length and
readability.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 747c1377-23f1-4f79-93ce-9faa72822500

📥 Commits

Reviewing files that changed from the base of the PR and between 27e943f and c9d2317.

📒 Files selected for processing (1)
  • src/camera.rs

@nixonyh nixonyh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shud add back the orbit functionality, but overall this is a great improvement to what we had.

@nixonyh
nixonyh enabled auto-merge (squash) June 5, 2026 16:14
@nixonyh
nixonyh merged commit d900ea8 into main Jun 5, 2026
8 checks passed
@nixonyh
nixonyh deleted the feature/flycam branch June 5, 2026 16:15
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.

3 participants