Jump to content

What's KSP's actual meaning of "closest" approach? It's not literally the closest.


Dunbaratu

Recommended Posts

In trying to write some mod code for kOS to help with intercepts and rendezvous, I noticed that what I was calculating for the closest approach chevrons was way off from what KSP reports in the map view for the closest approach chevrons, but that when I looked carefully and checked out what I was doing, it seems that this wasn't a bug in my code like I thought it was - the approach I'd found *was* actually closer than the one KSP picked. By a lot. But it wasn't necessarily a *practical* approach for intercepting because it's one that was 300 km in altitude "above" the target (while the approach KSP picked was about 550 km away, but it was 550 km away down at similar altitude to the target. This sort of makes sense to me because it's easier to intercept an object from a position 550 km behind it at the same altitude than when you're closer but but directly above it.

But this raises the question of what KSP actually uses for the definition of "closest" approach. It's not *really* the closest, as in finding the time T where the length of the line segment between your position at T and the target's position at T is at its minimum. That's what I solved for and I found that approach that's closer than KSP uses, but isn't practical because it's well *above* the target rather than behind or ahead of it.

So does anyone have any idea what it's using? Is it weighting the altitude difference as if it was a bigger magnitude than it really is for the sake of measuring distance? That would sort of make sense. Or is it taking the relative velocities into account too and trying to minimize some sort of score composed of both velocity difference and position difference?

I just don't know, and I was wondering if anyone with lots of gameplay experience had noticed this before and found a pattern to it?

Link to comment
Share on other sites

KSP is using patched conics to calculate all forms of intercept. There's a known shortcoming in KSP's patched conics in that it will often miss a "first pass" closest approach in an orbit if there is any sort of potential for an encounter further along in the traced path. This is why you will see an encounter "disappear" sometimes, and why you can have a much closer encounter when doing a rendezvous than you would otherwise. I unfortunately don't know the exact math that causes this to happen, but I do know how to reproduce it pretty reliably: as I said, all you need is for a potential solution further along in the orbit, and it will overwrite its memory of the first potential encounter.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...