mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(globe): keep the Navara camera above the ground
Navara 0.2.1's camera controller has no terrain or tile collision; its only zoom limit, minimumZoomDistance, is a distance from the Earth's centre, so a wheel zoom near the ground went through it (to -5.9 km). groundFloor.js runs on the engine's preRender after the camera model reads Navara's camera. While the camera is free (no flight, no lookAt target) and below 20 km it samples the ground under it (tiles, else terrain, else the ellipsoid; at most every 250 ms or 20 m), feeds Navara's clamp (minimumZoomDistance = geocentric radius of the ground point + 30 m, sent on changes over 10 m, reset to Navara's default during flights and above 20 km) so the wheel stops smoothly, and lifts a camera still below ground + 30 m straight up without camera.commanded. It only lifts, so it cannot oscillate with the shell's ground guard, whose lift is a flight the floor stands aside for.
This commit is contained in:
1 parent
4ded3fbf15
commit
64d3297301
6 files changed
+347
No files matched your search
@@ -394,6 +394,20 @@ export function createCameraModel({
|
||||
* for the user's own gestures, which are not a new camera owner.
|
||||
*/
|
||||
stopFlight: () => cancelCurrentFlight(),
|
||||
/**
|
||||
* Whether nothing else drives the camera: no flight and no lookAt target
|
||||
* (identity transform). The engine's ground floor acts only then.
|
||||
*/
|
||||
isFree: () =>
|
||||
flight == null &&
|
||||
transform.every((value, index) => value === matrix4.IDENTITY[index]),
|
||||
/**
|
||||
* Moves the camera to `position`, keeping its direction and up, without
|
||||
* camera.commanded: a correction (the ground floor), not a new owner.
|
||||
*/
|
||||
lift(position) {
|
||||
place({ ...state, position: copy3(position) });
|
||||
},
|
||||
/** The current camera for projections: pose, vertical fov and CSS size. */
|
||||
view,
|
||||
worldToWindow: (position, result) =>
|
||||
|
||||
Reference in new issue
Block a user