Repository navigation
Why we never re snap on a GPS update
Here is the bug that defines amateur location-based AR, and it is not really a bug — it is an architecture, chosen by accident:
navigator.geolocation.watchPosition((pos) => {
marker.position.copy(gpsToLocal(pos.coords)); // ← the mistake
});Every GPS update moves the content. Since consecutive GPS readings differ by metres, the content jumps by metres, several times a minute, forever. Users describe this as "glitchy" and conclude that browser AR is not ready. What they have actually observed is a design that treats each reading as truth.
The content did not move. Your estimate of where the content is moved, and you rendered the estimate directly.
There are two distinct quantities here and only one of them should ever change quickly:
- Where the object is in the world. A waypoint at a fixed latitude and longitude does not move. Ever. It is a constant of your application.
- The transform between the AR session's local frame and the world. This is unknown at session start and estimated from evidence. It genuinely does change as evidence arrives.
Assigning a new position to the object on every reading takes error in the second quantity and expresses it as motion in the first. The user's visual system, which is extremely good at detecting motion and has no opinion about your estimator, reads that as the world being unstable.
Keep the object where it is in the world, and put the correction into the transform:
- The object sits at its GPS coordinate, converted through the current alignment, inside the AR world group.
- Each GPS reading is an observation that refines the alignment, subject to outlier rejection so one multipath reading off a glass façade does not drag the fit.
- The alignment changes incrementally and continuously, not in discrete snaps, so the visual consequence of a correction is a slow settle rather than a jump.
The estimate is improving the whole time. It just is not shouting about it.
Small corrections can be absorbed invisibly. Larger ones cannot — and here the design gets more interesting than "smooth everything".
createGpsAnchor can defer a correction until the object is off-screen.
If the alignment shifts by a small amount while the user is looking directly
at a marker, applying it immediately would produce a visible twitch on the one
object the user is watching. Waiting until they look away and applying it then
means they never see the correction at all — they just find the marker
correctly placed when they look back.
The obvious worry is that deferring forever leaves content sitting somewhere stale while the user stares at it. The answer is not a size-based escape hatch — there used to be one, and it was removed in June 2026 — but a different layer doing the work.
Alignment is interpolated once, on the AR world group's matrix, which the camera also rides. So a large alignment change is already being applied smoothly to the entire view, together, before any per-anchor logic runs. The per-anchor commit only ever handles the small residual left over. Snapping one object on-screen because its residual was large did not fix staleness; it produced a visible jump in the one place the user was looking.
So the policy reads:
- Residual below a distance-scaled threshold → nothing to do.
- Above it, object off-screen → commit now, invisibly.
- Above it, object on-screen → wait, regardless of size.
with one narrow exception: an anchor created with its bootstrap skipped starts
at the session origin — effectively inside the user — so its first commit has
to land even while they are looking, or it never leaves. Anchors that bootstrap
normally are already placed at their seed pose and need no exemption. If you
want correctness over concealment, snap-every-tick is a mode rather than a
threshold to tune.
Every consumer of a fusion pipeline would otherwise reimplement this, and most would reimplement it as the naive version, because the naive version is one line and looks correct in a demo where you stand still.
The failure only appears when someone walks around outdoors for two minutes — which is to say, in the exact situation the whole product exists for, and the exact situation that is least convenient to test.
It generalises past AR. Whenever you render an estimated quantity directly, you convert estimator noise into user-visible motion. The fix is nearly always the same shape: separate the thing being estimated from the thing being displayed, apply corrections to the model rather than the view, and be deliberate about which corrections the user is allowed to see.
Start here
Building with it
How the alignment works
Testing & debugging
Perception
Shipping it
12 more pages — see the page list above.