fix(cockpit): radar contacts stay where the vessel layer draws them

The vessel layer draws other ships at their last AIS fix and does not
advance them, so dead-reckoning radar contacts moved the mismatch from own
ship to everyone else: a 15 kn ferry reported 90 s ago showed ~700 m ahead
of the ship out of the window. Own ship stays centred where the camera
rides; contacts go back to their last fixes, and the query drops the extra
reach and candidates (which could also cut the nearest ship in a crowd).
This commit is contained in:
Sameh Khamis committed 2026-11-08 14:09:17 -08:00
1 parent 0ba7ba6512
commit f96a89a9ef
7 files changed
+27 -114

No files matched your search

+8 -14
View File
@@ -37,8 +37,6 @@ import {
import { lookIsOffset, lookReadoutParts, wrapLookYaw } from '../cockpitLook.js';
import {
RADAR_MAX_CONTACTS,
RADAR_REACH_M,
deadReckonRadarContacts,
radarPicture,
radarRangeM,
radarRangeNm,
@@ -345,8 +343,9 @@ function updateVesselHud(info, nowMs, forceContext) {
/**
* Publish the bridge radar: nearby AIS vessels drawn heading-up from the
* camera's current heading, within the chosen range. Own ship sits where
* the camera rides (its fix dead-reckoned), and every contact is
* dead-reckoned to the same moment, so the picture matches the window.
* the camera rides (its fix dead-reckoned); contacts sit at their last
* fixes, where the vessel layer draws them, so the scope matches the
* window.
* @param {object} info The vessel subject (`readVesselInfo`).
*/
export function updateRadar(info) {
@@ -357,16 +356,11 @@ export function updateRadar(info) {
}
const rangeNm = radarRangeNm(this.radarRangeNm);
const own = this.vesselFix ?? info;
// Ask past the range for ships that have since moved into it; the picture
// trims them to the range once they are dead-reckoned.
const contacts = deadReckonRadarContacts(
layer.getRadarContacts(
own.latitude,
own.longitude,
radarRangeM(rangeNm) + RADAR_REACH_M,
RADAR_MAX_CONTACTS * 4,
),
Date.now(),
const contacts = layer.getRadarContacts(
own.latitude,
own.longitude,
radarRangeM(rangeNm),
RADAR_MAX_CONTACTS,
);
const picture = radarPicture(
{