Consider radii of very large stars

master
Armin Kretschmer 2019-11-19 15:38:26 +01:00 committed by GitHub
parent fbaa87a1bc
commit d74bcf2494
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -382,10 +382,9 @@ void Space::GetHyperspaceExitParams(const SystemPath &source, const SystemPath &
const double max_orbit_vel = 100e3;
double dist = G * primary->GetSystemBody()->GetMass() /
(max_orbit_vel * max_orbit_vel);
dist = std::max(dist, primary->GetSystemBody()->GetRadius() * 10);
// ensure an absolut minimum and an absolut maximum distance
dist = Clamp(dist, 0.2 * AU, 100 * AU);
// ensure an absolute minimum and an absolute maximum distance
dist = Clamp(dist, 0.2 * AU, std::max(primary->GetSystemBody()->GetRadius() * 1.1, 100 * AU));
// point velocity vector along the line from source to dest,
// make exit position perpendicular to it,