fix(3d): correct aircraft rotation axes and camera position

Pitch rotates around Y axis (wing axis), bank around X axis
(longitudinal axis). Camera moved to front-right view to clearly
show both pitch and bank movements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
itsrubberduck
2026-02-20 23:32:13 +01:00
parent a22fcbd240
commit 0d1dae87e7

View File

@@ -98,7 +98,8 @@ function initScene() {
// Camera
camera = new THREE.PerspectiveCamera(50, width / height, 0.1, 200)
camera.position.set(-8, 3, 5)
// View from front-right, slightly above — shows pitch and bank clearly
camera.position.set(6, 2, 4)
camera.lookAt(0, 0, 0)
// Lights
@@ -155,10 +156,11 @@ function animate() {
animFrameId = requestAnimationFrame(animate)
if (aircraft) {
// Pitch: rotate around Z axis (nose up/down in our coordinate system)
aircraft.rotation.z = lerp(aircraft.rotation.z, -targetPitchRad, 0.1)
// Bank: rotate around X axis
aircraft.rotation.x = lerp(aircraft.rotation.x, -targetBankRad, 0.1)
// Aircraft flies along +X, wings along Y, Z is up
// Pitch: rotate around Y axis (wing axis) — positive pitch = nose up
aircraft.rotation.y = lerp(aircraft.rotation.y, targetPitchRad, 0.1)
// Bank: rotate around X axis (longitudinal axis) — positive bank = right wing down
aircraft.rotation.x = lerp(aircraft.rotation.x, targetBankRad, 0.1)
}
if (renderer && scene && camera) {