From c0d494259eaef32c7d1ddf53fc55865210a6ebcd Mon Sep 17 00:00:00 2001 From: Willow Sparks Date: Wed, 28 Jan 2026 10:46:18 +0000 Subject: [PATCH] Fix all movement directions to rotate in 4D space The original fix only applied 4D rotation to Q/E (ana/kata) movement. W/A/S/D movement was still projected to XZ plane only, stripping the W component even after 4D rotation. Now all movement directions (forward, right, ana) are projected to the XZW hyperplane, keeping their W components. This means: - After 4D rotation, W/S affects W coordinate (not just X/Z) - After 4D rotation, A/D affects W coordinate (not just X/Z) - After 4D rotation, Q/E affects X/Z coordinates (not just W) All movement now correctly rotates with the camera's 4D orientation. Co-Authored-By: Claude Opus 4.5 --- src/main.rs | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1fe191c..77413ad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -311,29 +311,19 @@ impl ApplicationHandler for App { let w_input = self.controller.get_w_input(); // 2. Calculate movement direction in world space using camera orientation - // Get camera forward/right projected onto XZ plane (horizontal movement only) + // Get camera direction vectors let camera_forward = self.camera.forward(); let camera_right = self.camera.right(); - - // Project to XZ plane (zero out Y for horizontal movement) - let forward_xz = Vec4::new(camera_forward.x, 0.0, camera_forward.z, 0.0).normalized(); - let right_xz = Vec4::new(camera_right.x, 0.0, camera_right.z, 0.0).normalized(); - - // Get camera's W (ana) direction, projected to horizontal (XZW) plane let camera_ana = self.camera.ana(); - let ana_xzw = Vec4::new(camera_ana.x, 0.0, camera_ana.z, camera_ana.w).normalized(); - // DEBUG: Print ana values when W movement is active - if w_input.abs() > 0.0 { - let move_from_w = ana_xzw * w_input; - eprintln!("DEBUG W-move: ana()=({:.2},{:.2},{:.2},{:.2}) | projected=({:.2},{:.2},{:.2},{:.2}) | movement=({:.2},{:.2},{:.2},{:.2})", - camera_ana.x, camera_ana.y, camera_ana.z, camera_ana.w, - ana_xzw.x, ana_xzw.y, ana_xzw.z, ana_xzw.w, - move_from_w.x, move_from_w.y, move_from_w.z, move_from_w.w); - } + // Project all directions to XZW hyperplane (zero out Y for horizontal movement) + // This ensures all movement rotates correctly in 4D space + let forward_xzw = Vec4::new(camera_forward.x, 0.0, camera_forward.z, camera_forward.w).normalized(); + let right_xzw = Vec4::new(camera_right.x, 0.0, camera_right.z, camera_right.w).normalized(); + let ana_xzw = Vec4::new(camera_ana.x, 0.0, camera_ana.z, camera_ana.w).normalized(); - // Combine movement direction (all axes from camera orientation) - let move_dir = forward_xz * forward_input + right_xz * right_input + // Combine movement direction (all axes rotate with 4D camera orientation) + let move_dir = forward_xzw * forward_input + right_xzw * right_input + ana_xzw * w_input; // 3. Apply movement to player via unified physics world (includes W for true 4D physics) -- knotmirror 0.0.1