Fix: rotation.z is the actual pitch axis, not rotation.x
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 <noreply@anthropic.com>
This commit is contained in:
parent
710551082c
commit
7cebdf86ed
@ -136,12 +136,16 @@ function tick() {
|
|||||||
|
|
||||||
planeHolder.position.set(px, py + bob, 0);
|
planeHolder.position.set(px, py + bob, 0);
|
||||||
|
|
||||||
/* Banking — léger roulis + nez relevé (cabré réaliste) */
|
/* Pour un avion volant -X (nose à gauche), avec up = +Y :
|
||||||
const targetRoll = 0.18 + (p - 0.5) * 0.25; // .z = roulis
|
- rotation.z (axe latéral du monde) = PITCH. Négatif → nez en l'air.
|
||||||
const targetPitch = -0.18 - p * 0.04; // .x = nez en l'air ~10°
|
- rotation.x (axe longitudinal du monde) = ROLL.
|
||||||
const targetYaw = -(p - 0.5) * 0.10; // .y = soupçon de yaw
|
- rotation.y (axe vertical du monde) = YAW.
|
||||||
planeHolder.rotation.z += (targetRoll - planeHolder.rotation.z) * 0.08;
|
*/
|
||||||
planeHolder.rotation.x += (targetPitch - planeHolder.rotation.x) * 0.08;
|
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;
|
planeHolder.rotation.y += (targetYaw - planeHolder.rotation.y) * 0.08;
|
||||||
|
|
||||||
renderer.render(scene, camera);
|
renderer.render(scene, camera);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user