Merge pull request #4660 from robothauler/max_dist

Add a maximum distance to the hyperspace exit calculation
master
Andrew Copland 2019-11-19 18:09:09 +00:00 committed by GitHub
commit 05c09b9865
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -340,10 +340,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 distance
dist = std::max(dist, 0.2 * 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,