mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
fix(cockpit): a provider's subject rides where it is drawn, and the documented provider rides a moving train
- A frame with no speedMps gets an exact anchor: an inertial one ran on at zero speed and closed at 0.75 m/s, so the camera fell kilometres behind a moving train. The docs example now passes speedMps and anchor: 'exact', a name for its HUD, and isEntryAllowed for a train bound to its line. - Transit's snapshot height is the floor where playback draws the vehicle, not the newest report's floor uphill, and null while that floor is cold, so a view waits for the surface instead of standing on the ellipsoid. - Rail's direction follows playback once it has placed the train: a report that runs back (a reversal, or GPS jitter) no longer turns the view while the drawn train still runs forward. - A frame's id is trimmed as the candidate's is. - A double-click on the selected vessel no longer enters an application's subject that took entry after it. - The docs import from gods-eye-view/..., the package's name.
This commit is contained in:
1 parent
974023510f
commit
4bb7b411e9
10 files changed
+161
-21
No files matched your search
@@ -753,6 +753,27 @@ test('disable aborts in-flight work and a response that lands late is ignored',
|
||||
assert.equal(app.vehicles().length, 1);
|
||||
});
|
||||
|
||||
test('a held vehicle with no floor yet tells its view no height', async (t) => {
|
||||
// Not the ellipsoid: a first-person view waits for the surface instead.
|
||||
const app = harness(t, { floorAt: () => undefined });
|
||||
app.serve('mbta', () => ({
|
||||
status: 200,
|
||||
body: snapshot(
|
||||
'mbta',
|
||||
'MBTA',
|
||||
[vehicle('bus-1', 42.36, -71.06, Date.now() / 1000)],
|
||||
{ fetchedAt: Date.now() },
|
||||
),
|
||||
}));
|
||||
app.layer.enable(app.viewer);
|
||||
await app.layer.update();
|
||||
app.settle();
|
||||
const entry = app.vehicles()[0];
|
||||
assert.equal(entry.heightPending, true, 'it has nothing to stand on');
|
||||
assert.ok(app.layer.setCockpitSubject(entry.key) !== false);
|
||||
assert.equal(app.layer.getCockpitSubject().position.groundHeightM, null);
|
||||
});
|
||||
|
||||
test('a vehicle waits for its floor rather than standing on the ellipsoid', async (t) => {
|
||||
// The shared ground-floor system answers from the rendered mesh cell or the
|
||||
// real DEM cell; until one of them is warm there is no honest height to draw
|
||||
@@ -1800,11 +1821,19 @@ test('a segment climbs from the ground it left to the ground it reaches', async
|
||||
assert.ok(Math.abs(entry.heightM - 101.5) < 1, 'the destination is uphill');
|
||||
const height = () =>
|
||||
Cesium.Cartographic.fromCartesian(entry.marker.position).height;
|
||||
// A first-person view reads the floor where the vehicle is drawn, not the
|
||||
// newest report's floor uphill.
|
||||
app.layer.setCockpitSubject(entry.key);
|
||||
const floor = () => app.layer.getCockpitSubject().position.groundHeightM;
|
||||
app.run(400);
|
||||
assert.ok(
|
||||
height() < 30,
|
||||
`still on the ground it is drawn on, got ${height().toFixed(1)} m`,
|
||||
);
|
||||
assert.ok(
|
||||
Math.abs(floor() + 1.5 - height()) < 1,
|
||||
`its snapshot stands where it is drawn, got ${floor().toFixed(1)} m`,
|
||||
);
|
||||
|
||||
// Halfway along the segment it is halfway up; at the end, on the high ground.
|
||||
const firstFixAt = start - AGE_MS;
|
||||
@@ -1818,6 +1847,7 @@ test('a segment climbs from the ground it left to the ground it reaches', async
|
||||
Math.abs(height() - 101.5) < 1.5,
|
||||
`and arrives on the high ground, got ${height().toFixed(1)} m`,
|
||||
);
|
||||
assert.ok(Math.abs(floor() - 100) < 1.5, 'and so does its snapshot');
|
||||
});
|
||||
test('a lone impossible fix leaves the displayed vehicle and health untouched', async (t) => {
|
||||
const app = harness(t, { floorAt: () => 5 });
|
||||
|
||||
Reference in new issue
Block a user