From 7cebdf86ed376b874d47539b2ecf107b629157b7 Mon Sep 17 00:00:00 2001 From: MVA Global Fret Date: Tue, 5 May 2026 12:31:51 +0200 Subject: [PATCH] Fix: rotation.z is the actual pitch axis, not rotation.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The labels in the previous commit were swapped. With the wrapper rotated -π/2 around Y so the nose points -X, the plane's longitudinal axis is world X (so rotation.x is roll) and its lateral axis is world Z (so rotation.z is pitch). Earlier code applied "roll" (positive 0.18) to .z, which was actually pitching the nose down — no amount of tweaking rotation.x could compensate, hence the user seeing the plane go forward+down even after sign flips. Now: - rotation.z = -0.30 - p·0.05 (nose up ~17–20°, climb attitude) - rotation.x = 0.12 + small variation (subtle roll) - rotation.y = 0 (no yaw, plane already heading the right way) Co-Authored-By: Claude Opus 4.6 --- js/intro-scene.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/js/intro-scene.js b/js/intro-scene.js index 5e5a1d2..df5c0d2 100644 --- a/js/intro-scene.js +++ b/js/intro-scene.js @@ -136,12 +136,16 @@ function tick() { planeHolder.position.set(px, py + bob, 0); - /* Banking — léger roulis + nez relevé (cabré réaliste) */ - const targetRoll = 0.18 + (p - 0.5) * 0.25; // .z = roulis - const targetPitch = -0.18 - p * 0.04; // .x = nez en l'air ~10° - const targetYaw = -(p - 0.5) * 0.10; // .y = soupçon de yaw - planeHolder.rotation.z += (targetRoll - planeHolder.rotation.z) * 0.08; - planeHolder.rotation.x += (targetPitch - planeHolder.rotation.x) * 0.08; + /* Pour un avion volant -X (nose à gauche), avec up = +Y : + - rotation.z (axe latéral du monde) = PITCH. Négatif → nez en l'air. + - rotation.x (axe longitudinal du monde) = ROLL. + - rotation.y (axe vertical du monde) = YAW. + */ + const targetPitch = -0.30 - p * 0.05; // ~17°-20° nez en l'air (montée) + const targetRoll = 0.12 + (p - 0.5) * 0.10; // léger roulis + const targetYaw = 0; + planeHolder.rotation.z += (targetPitch - planeHolder.rotation.z) * 0.08; + planeHolder.rotation.x += (targetRoll - planeHolder.rotation.x) * 0.08; planeHolder.rotation.y += (targetYaw - planeHolder.rotation.y) * 0.08; renderer.render(scene, camera);