mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Stand an inertial subject on its floor once the floor arrives
- The first floor height that replaces the entry frame's height re-anchors the camera and resets the smoothed rise, so the subject stands on the floor within a second instead of hovering above it. - A provider's thenable gets one rejection handler; frame fields and eye are read once each. - A progress label's width counts the smaller detail line and full-width and astral glyphs. - Tests cover the first camera update of an aircraft and a vessel, a double-click on a selected vessel, a tone-only Live Signals change and a getter that throws on its second read; repeated cases share helpers. - Comments, the release note and CURRENT-STATE say which height the camera holds while it waits for the surface and how a Live Signals row keeps its time.
This commit is contained in:
1 parent
109bb0fd4f
commit
c190e662bc
13 files changed
+314
-211
No files matched your search
+16
-5
@@ -357,6 +357,7 @@ function updateSubject(nowMs) {
|
||||
}
|
||||
this.lastSubjectFrame = frame;
|
||||
let heightM = frame.heightM;
|
||||
let held = false;
|
||||
if (heightM === null) {
|
||||
this.services.warmGroundFloor?.([
|
||||
{ lat: frame.latitude, lon: frame.longitude },
|
||||
@@ -366,8 +367,10 @@ function updateSubject(nowMs) {
|
||||
frame.longitude,
|
||||
);
|
||||
// A frame with no height stands on the shared floor; while that is cold
|
||||
// it keeps the last height it had, the entry frame's included.
|
||||
heightM = Number.isFinite(floorM) ? floorM : this.subjectHeightM;
|
||||
// the eye keeps the last height it stood at (a frame's or the floor's),
|
||||
// at first the entry frame's.
|
||||
held = !Number.isFinite(floorM);
|
||||
heightM = held ? this.subjectHeightM : floorM;
|
||||
}
|
||||
if (!Number.isFinite(heightM)) {
|
||||
// Nothing to stand on yet, from the first frame: the camera stays where
|
||||
@@ -399,6 +402,14 @@ function updateSubject(nowMs) {
|
||||
}
|
||||
this.surfaceWaitStartedMs = 0;
|
||||
this.surfaceAcquiring = false;
|
||||
if (!held) {
|
||||
// The first height to replace the entry frame's places the anchor
|
||||
// anew: an inertial one would close on it only at the horizontal
|
||||
// correction's rate.
|
||||
if (this.subjectHeightFromEntry && heightM !== this.subjectHeightM)
|
||||
this.cockpitAnchorValid = false;
|
||||
this.subjectHeightFromEntry = false;
|
||||
}
|
||||
this.subjectHeightM = heightM;
|
||||
const target = fromDegrees(frame.longitude, frame.latitude, heightM);
|
||||
const dtSec = cockpitSubjectStepSec(nowMs - this.lastFrameMs, intervalMs);
|
||||
@@ -461,11 +472,11 @@ function updateSubject(nowMs) {
|
||||
* Aircraft pass none and look along the heading at the profile pitch.
|
||||
*/
|
||||
function placeCamera(target, info, nowMs, dtSec, profile, look = null) {
|
||||
// The update that first sets the anchor stands it on the target: the time
|
||||
// before it (an entry, a floor wait) moved nothing, so it has no step.
|
||||
// An update that sets the anchor stands it on the target with no step:
|
||||
// the first one (the time before it, an entry or a floor wait, moved
|
||||
// nothing), and a subject's whose height replaced its entry frame's.
|
||||
const anchoring = !this.cockpitAnchorValid;
|
||||
if (anchoring) {
|
||||
this.cockpitAnchor = clone(target);
|
||||
this.cockpitAnchorValid = true;
|
||||
this.subjectLiftM = null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user