diff --git a/scratchpad/reports/2026-01-27-camera-movement-investigation.md b/scratchpad/reports/2026-01-27-camera-movement-investigation.md new file mode 100644 index 0000000..aa0745b --- /dev/null +++ b/scratchpad/reports/2026-01-27-camera-movement-investigation.md @@ -0,0 +1,74 @@ +# Session Report: Camera Movement Investigation + +**Date:** 2026-01-27 +**Duration:** ~1 session +**Outcome:** Confirmed movement system is working correctly + +## Summary + +Investigated reports that A/D/Q/E movement felt "weird" after camera rotation. After detailed analysis, confirmed the behavior is mathematically correct and matches Engine4D's implementation. The "weirdness" is inherent to 4D rotations, not a bug. + +## Investigation + +### Initial Concern +User reported that A/D (strafe) and Q/E (ana/kata) movement felt wrong after rotating the camera. + +### Analysis Performed + +1. **Added debug test** to print direction vectors after various rotations +2. **Traced movement transformation** through camera_matrix +3. **Compared with Engine4D** source code for movement handling + +### Findings + +| After Rotation | D (strafe right) | Q (ana) | +|----------------|------------------|---------| +| No rotation | +X (right) | +W (into 4D) | +| 90° yaw | +Z (correct!) | +W (unchanged) | +| 90° rotate_w | -W (into 4D!) | +X (3D right!) | + +**Key insights:** + +1. **Yaw works correctly** - A/D strafe relative to facing direction +2. **Q/E doesn't follow yaw** - ana/kata always moves in world ±W regardless of horizontal facing. This matches Engine4D behavior. +3. **4D rotations mix A/D with Q/E** - After rotate_w, strafe moves into 4D and ana moves in 3D. This is mathematically correct for an XW rotation. + +### Engine4D Comparison + +Confirmed Engine4D uses the same approach: +- `camMatrix * accel` transforms all movement by camera orientation +- Q/E (ana/kata) available in normal mode, bound to same keys +- W-movement is always camera-relative via camMatrix +- 4D rotations affect movement directions the same way + +## Conclusion + +The movement system is working as intended. The "weird" feeling comes from: + +1. **Q/E not following yaw** - This is by design (world W axis) +2. **4D rotations being disorienting** - A/D and Q/E mixing is correct 4D math, just hard to build intuition for + +User confirmed after explanation that they were misinterpreting correct 4D behavior as bugs. + +## How to Distinguish Correct vs Bug + +For future reference: + +**Orbital bug (wrong):** +- Object swings around a pivot point +- Object shape stays the same +- Camera position changes unexpectedly + +**Correct 4D rotation:** +- 3D cross-section changes shape +- Parts appear/disappear as slice changes +- Camera position (title bar) stays fixed +- Objects seem to "move" but it's different slicing + +## Files Changed + +- `crates/rust4d_render/src/camera4d.rs` - Added then removed debug test + +## Commits + +- `fba5044` Remove debug test from camera4d