Jump to content

Determining if Vessel's Orbit Has SOI Transition


Recommended Posts

I've been writing a plugin that filters out vessels that meet certain criteria. The current code I have is below:


FlightGlobals.Vessels.Where(v => v.vesselType == VesselType.Debris)
.Where(v => v.orbit.eccentricity < 1.0)
.Where(v => v.mainBody.atmosphere)
.Where(v => v.orbit.PeA < v.mainBody.atmosphereDepth)
.ToList();

Obviously, those with hyperbolic trajectories are already excluded, but I also need to exclude those that have an upcoming SOI transition of any type (e.g. Kerbin -> Mun encounter). Anyone with suggestions on the best way to do this? I see the Orbit class has several attributes that seem relevant to how I would achieve this: activePatch, closestEncounterBody, closestEncounterLevel, closestEncounterPatch, nextPatch, patchEndTransition, patchStartTransition, previousPatch, timeToTransition1, timeToTransition2. I'm just not sure what would be best. Thanks in advanced!

Link to comment
Share on other sites

I think the following is what I need to add to the above:


.Where(v => v.orbit.closestEncounterLevel == Orbit.EncounterSolutionLevel.NONE)

If anyone can confirm this is the appropriate solution, please let me know. Thanks!

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...