NaN period on parabolic orbits

SMOKE

New Member
Messages
9
Reaction score
13
Bug: NaN period on parabolic orbits in CorrectionBurnTask.NextClosestApproach (KSA 2026.11.16.5901)

First, thanks for the 5901 change that swapped the six Eccentricity < 1.0 checks in Orbit for IsBound(). It fixed the per-frame crash in Vehicle.UpdatePerFrameData on parabolic orbits, and I've removed the workaround from my mod.

The same pattern is still in CorrectionBurnTask.NextClosestApproach:

double num = a.Period;
if (a.Eccentricity > 1.0)
num = 110.0 / a.GetMeanMotion();
UniverseTime universeTime2 = gameTime + num;

Orbit.Create makes an orbit Parabolic when its energy is within 1e-6 of zero, and OrbitData gives a parabolic orbit Period = NaN. That band reaches down to about e ≈ 0.999996, and e = 1 exactly fails > 1.0 too. So a parabolic orbit keeps num = NaN, and the NaN ends up in a UniverseTime, which throws.

When: planning a correction burn while the orbit is momentarily parabolic, for example in the middle of a burn that crosses escape. That's rare, but it fails the same way as the old per-frame crash.

Suggested fix: if (!a.IsBound()) in place of if (a.Eccentricity > 1.0), matching the 5901 change.

Same pattern, lower impact:
- Orbit.GetNearestPoint: Eccentricity >= 1.0 || IsParabolic(Eccentricity) sends a parabolic orbit with e just under 1 down the closed-orbit branch. It works from cached points, so I'd expect a hover glitch at worst, not a crash.
- OrbitalTransfers.SingleImpulseHyperbolicEscape: the eccentricity >= 1.0 guard lets a parabolic parking orbit through. Its SemiMajorAxis is +∞, so the maths after it would turn into NaN.
 
Upvote 1
Back
Top