From 6fcc772bf0971f988e8d5f5c058d70f3c825b391 Mon Sep 17 00:00:00 2001 From: MVA Global Fret Date: Tue, 5 May 2026 12:39:42 +0200 Subject: [PATCH] Match trajectory to user-drawn line: high cruise, gentle climb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User sketched a near-horizontal red line in the upper third of the viewport, slightly higher on the left than on the right. Mapping that to world coords with the camera at z=22 and 40° vfov: - right end (entrance): y ≈ +3.5 - left end (exit): y ≈ +5 So the plane keeps cruising in the upper portion of the frame and climbs ~1.5 world units across 40 horizontal units — about 2° of slope. Pitch follows: rotation.z = -0.06 - p·0.01 (3.5–4° nose-up, matching the slope). Roll softened to 0.04 ± 0.02 since the path is nearly straight. Co-Authored-By: Claude Opus 4.6 --- js/intro-scene.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/js/intro-scene.js b/js/intro-scene.js index 03e9271..8e7a280 100644 --- a/js/intro-scene.js +++ b/js/intro-scene.js @@ -125,26 +125,25 @@ function tick() { root.style.setProperty('--mx', ((mouse.px - 0.5) * 2).toFixed(4)); root.style.setProperty('--my', ((mouse.py - 0.5) * 2).toFixed(4)); - /* Trajectoire droite → gauche, en descente (approche) : - - p = 0 → entre haut-droite (hors champ) - - p = 0.5 → traverse en diagonale descendante - - p = 1 → sort bas-gauche (hors champ) + /* Trajectoire droite → gauche, en très légère montée : + - p = 0 → entre par la droite à mi-hauteur haute (y ≈ 3.5) + - p = 0.5 → traverse à y ≈ 4.25 + - p = 1 → sort par la gauche un peu plus haut (y ≈ 5) + Pente ≈ 1.5/40 ≈ 2° (presque horizontal). */ - const px = 18 - p * 40; // +18 → -22 - const py = 6 - p * 16; // +6 (haut) → -10 (bas hors champ) - const bob = Math.sin(t * 0.9) * 0.10; + const px = 18 - p * 40; // +18 → -22 (toujours bien hors champ aux deux bouts) + const py = 3.5 + p * 1.5; // +3.5 → +5 (douce montée) + const bob = Math.sin(t * 0.9) * 0.08; planeHolder.position.set(px, py + bob, 0); - /* Pour un avion volant -X (nez à gauche), avec up = +Y : - - rotation.z (axe latéral du monde) = PITCH. Positif → nez baissé. - - rotation.x (axe longitudinal du monde) = ROLL. - - rotation.y (axe vertical du monde) = YAW. - Slope de la trajectoire ≈ -16/40 = -22° → on incline le nez de - manière analogue pour suivre la pente. + /* Avec nez à -X et up = +Y : + - rotation.z = PITCH (négatif = nez en l'air) + - rotation.x = ROLL + Pente de 2° → on relève le nez légèrement pour suivre la trajectoire. */ - const targetPitch = 0.32 + p * 0.05; // nez en bas ~18°-21° (descente) - const targetRoll = 0.12 + (p - 0.5) * 0.10; // léger roulis + const targetPitch = -0.06 - p * 0.01; // nez ~3.5°-4° en l'air + const targetRoll = 0.04 + (p - 0.5) * 0.04; // roulis très subtil const targetYaw = 0; planeHolder.rotation.z += (targetPitch - planeHolder.rotation.z) * 0.08; planeHolder.rotation.x += (targetRoll - planeHolder.rotation.x) * 0.08;