considerFrameChange

function considerFrameChange
simulation/src/flight.ts:663
considerFrameChange(world: FlightWorld, entity: Entity, binding: FrameBinding, time: number, previous: SoiWatch | null, speedBound: number | null) → SoiVerdict

Move an entity up or down the frame hierarchy as it enters and leaves spheres of influence.

This is the "transition into increasingly local coordinate frames" the vertical slice has to demonstrate, and it is deliberately invisible: the entity's canonical position and velocity are unchanged by the move. Only the numbers it carries change.

Descend first: being inside a moon's SOI is more specific than being inside its planet's, and checking children before the parent gets that ordering right without a special case.

The loop is over every child of the current frame, which for a star is every body orbiting it — sixty-seven in Sol — and each one's honest test is a Kepler solve and a pose composition. Two things keep it from being paid per child per tick. A child can only be within reach if the entity's distance from the parent overlaps the child's own orbital band, which periapsis and apoapsis give exactly, by the triangle inequality. And a child that was found to be g meters out of reach cannot be in reach until the entity and the child have between them closed g, which SoiWatch carries forward as a gap that each tick's movement consumes. Only a child whose gap has run out is looked at again — and when one is, every gap is re-based on the entity's new position, so the bound never loosens through accumulated travel.

speedBound is how fast the entity can move, when the caller knows: a coast has one (its periapsis speed) and turns safeFor into the next instant any test could fire, so a warping frame can jump straight to it. A thrusting ship has no such bound and passes null.

worldFlightWorld
Undocumented
entityEntity
Undocumented
bindingFrameBinding
Undocumented
timenumber
Undocumented
previousSoiWatch | null
Undocumented
speedBoundnumber | null
Undocumented
ReturnsSoiVerdict