diff --git a/App/sims/klima/game-3d.html b/App/sims/klima/game-3d.html index ad2c468..6defffd 100644 --- a/App/sims/klima/game-3d.html +++ b/App/sims/klima/game-3d.html @@ -1539,7 +1539,16 @@ function buyMeasure(id) { } function finalizeBuy(id, hitPos) { - const rotation = +placementRotation.toFixed(3); + let rotation = +placementRotation.toFixed(3); + // Flughafen-Ausrichtung: Runway (lokales +X = Start-Richtung) zeigt + // IMMER vom Vulkan weg, damit Starts und Landungen in den offenen Ozean + // gehen und nicht in die Bergflanke. Überschreibt die zufällige + // placementRotation für Airports. + if (id === 'airport') { + const dx = hitPos.x - VOLCANO_X; + const dz = hitPos.z - VOLCANO_Z; + rotation = +Math.atan2(-dz, dx).toFixed(3); + } const zone = MEASURE_ZONES_3D[id]; const zoneId = zone ? zone.kind : 'land'; const resolveMeta = () => ({ pos: hitPos, rotation, zoneId }); @@ -3980,14 +3989,18 @@ function updateAirportVehicles(tNow) { } } -// Lokale→Welt-Transformation für Airport-relative Punkte (inkl. Airport-Rotation) +// Lokale→Welt-Transformation für Airport-relative Punkte. Entspricht exakt +// dem, was Three.js intern für Child-Meshes macht (rotation.y um Y-Achse): +// (lx, ly, lz) → (Px + lx·cosR + lz·sinR, Py + ly, Pz − lx·sinR + lz·cosR) +// Frühere Version hatte falsche Vorzeichen → Flugzeug flog bei rotierten +// Flughäfen rückwärts, Heli-Lande-Position war schräg versetzt. function airportLocalToWorld(airportMesh, lx, ly, lz) { const cosR = Math.cos(airportMesh.rotation.y); const sinR = Math.sin(airportMesh.rotation.y); return { - x: airportMesh.position.x + lx * cosR - lz * sinR, + x: airportMesh.position.x + lx * cosR + lz * sinR, y: airportMesh.position.y + ly, - z: airportMesh.position.z + lx * sinR + lz * cosR, + z: airportMesh.position.z - lx * sinR + lz * cosR, }; } @@ -4072,9 +4085,9 @@ function updateSinglePlane(v, tNow, airportMesh) { const RUNWAY_END = 2.2; // lokal, nach 2x-Scale also 4.4 in Welt const RUNWAY_Y = 0.50; // auf Plateau-Oberkante (LIFT+Scale²≈0.26) - // Zyklus-Phase (Sekunden) mit individuellem Offset pro Airport, plus - // +60 s Grund-Offset damit Plane nicht sofort beim Level-Start startet. - const tPhase = (tNow + v.phaseOffset + 60) % PLANE_CYCLE; + // Zyklus-Phase — beginnt sofort in Phase 0 (Plane steht auf Runway), + // damit beim Bau des Airports das Flugzeug direkt sichtbar ist. + const tPhase = (tNow + v.phaseOffset) % PLANE_CYCLE; plane.visible = true; const prop = plane.userData.propRef; diff --git a/App/sims/klima/plane-test.html b/App/sims/klima/plane-test.html new file mode 100644 index 0000000..d690223 --- /dev/null +++ b/App/sims/klima/plane-test.html @@ -0,0 +1,232 @@ + + + + +Flugzeug-Orientierungs-Test + + + +
+
+
Flugzeug-Orientierungs-Test · Bewegungsrichtung = roter Pfeil (→ weltliches +X)
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+
+ Der rote Pfeil zeigt die Bewegungsrichtung bei „Flug simulieren".
+ Finde die rotation.y-Werte, bei denen die Nase des Flugzeugs GENAU auf dem Pfeil steht (vorwärts fliegt), + und meld mir die Werte (oder drück „Werte kopieren"). π ≈ 3.14, π/2 ≈ 1.57. +
+
+ + + + +