Switch trajectory to descending right→top to left→bottom, nose down

Reroute the plane: it now enters from the upper-right (y=+6) and
exits at the lower-left (y=-10), so the path slopes downward as a
~22° descent (slope = -16/40 in world units). Pitch reversed to
match — rotation.z = +0.32 + p·0.05 (≈18-21° nose-down) so the
plane's body aligns with the descent line. Roll and yaw unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MVA Global Fret 2026-05-05 12:35:03 +02:00
parent 7cebdf86ed
commit 6cf619857a

View File

@ -125,23 +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 montée :
- p = 0 entre par la droite (légèrement bas)
- p = 0.5 traverse au centre, en train de monter
- p = 1 sorti complètement, en haut-gauche hors champ
/* 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)
*/
const px = 18 - p * 40; // +18 → -22 (large marge de sortie)
const py = -1 + p * 13; // -1 → +12 (en montée, sort du cadre par le haut)
const bob = Math.sin(t * 0.9) * 0.12;
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;
planeHolder.position.set(px, py + bob, 0);
/* Pour un avion volant -X (nose à gauche), avec up = +Y :
- rotation.z (axe latéral du monde) = PITCH. Négatif nez en l'air.
/* 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.
*/
const targetPitch = -0.30 - p * 0.05; // ~17°-20° nez en l'air (montée)
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 targetYaw = 0;
planeHolder.rotation.z += (targetPitch - planeHolder.rotation.z) * 0.08;