mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Keep the cockpit camera steady near the ground on both engines
Cesium lifts a camera below its globe every frame, between the cockpit's 20 Hz updates, so an eye placed under the terrain (an aircraft reading below it on a cold floor cell) jumped up and down. The cockpit now also keeps its eye above the engine's own surface. Navara's ground floor stands aside while the camera inputs are off, since the cockpit places the camera itself.
This commit is contained in:
1 parent
9825b02aab
commit
90166024e9
8 files changed
+105
-9
No files matched your search
+14
-6
@@ -317,12 +317,20 @@ export function update() {
|
||||
if (cameraCartographic) {
|
||||
const cameraLat = geo.math.toDegrees(cameraCartographic.latitude);
|
||||
const cameraLon = geo.math.toDegrees(cameraCartographic.longitude);
|
||||
const cameraFloorM = this.services.cachedGroundFloor(cameraLat, cameraLon);
|
||||
if (Number.isFinite(cameraFloorM)) {
|
||||
cockpitFloorM = Math.max(
|
||||
cockpitFloorM ?? Number.NEGATIVE_INFINITY,
|
||||
cameraFloorM,
|
||||
);
|
||||
// The engine's own surface under the eye counts too: Cesium lifts a
|
||||
// camera below its globe every frame, between these 20 Hz updates, so an
|
||||
// eye under it (a contact reading below the terrain on a cold floor
|
||||
// cell) jumped up and down.
|
||||
for (const floorM of [
|
||||
this.services.cachedGroundFloor(cameraLat, cameraLon),
|
||||
this.host.terrainHeight(cameraCartographic),
|
||||
]) {
|
||||
if (Number.isFinite(floorM)) {
|
||||
cockpitFloorM = Math.max(
|
||||
cockpitFloorM ?? Number.NEGATIVE_INFINITY,
|
||||
floorM,
|
||||
);
|
||||
}
|
||||
}
|
||||
const safeHeightM = cockpitGroundSafeHeight(
|
||||
cameraCartographic.height,
|
||||
|
||||
Reference in new issue
Block a user