Jump to content

How to get the *actual* position at UT for an orbit that enters another SOI?


Recommended Posts

I'm trying to implement an orbit solver for the kOS mod (i.e. let people see their future position at time T, taking into account all maneuver nodes (assuming they get executed as planned) and orbit transitions).

I've almost got it working except for one annoying problem.

When I call the KSP API method Orbit.getPositionAtUT(timestamp) to predict the future position of an orbit patch that's in an SOI I'm not currently in right now, it gives me the location relative to where that SOI body is NOW, rather than where it will be later at the timestamp.

Say I'm on a course for a Munar flyby from Kerbin. My future orbit patches therefore consist of an orbit in Kerbin's SOI that's aimed about 90 degrees ahead of where the Mun is now, so it then transitions into another orbit patch that's in the Mun's SOI for a while, that transitions into an orbit back in Kerbin's SOI again.

When I take the piece of that in the Mun's SOI, and call Orbit.getPositionAtUT(timestamp) I end up with totally the wrong position because it's giving me a position relative to where the Mun is NOW, not where it will be when the transition happens, 90 degrees around its orbit or so.

Has anyone else encountered this and do they know a good workaround?

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