martincmartin Posted March 10, 2016 Share Posted March 10, 2016 I'm trying to get the speed at apoapsis from an Orbit. I see getOrbitialVelocityAtUT() and timeToAp, but what is Universal Time? Does it start now? At the start of the epoch? How do I get the current time since the epoch? Link to comment Share on other sites More sharing options...
sarbian Posted March 10, 2016 Share Posted March 10, 2016 The current time is Planetarium.GetUniversalTime () Here is how to get your next Ap & Pe UT : https://github.com/MuMech/MechJeb2/blob/master/MechJeb2/OrbitExtensions.cs#L190-L219 Current time + timeToAP would work too. Link to comment Share on other sites More sharing options...
Padishar Posted March 10, 2016 Share Posted March 10, 2016 Using an intermediate time makes this quite a bit less efficient than it can be. All you need is vis-viva: https://github.com/CYBUTEK/KerbalEngineer/blob/master/KerbalEngineer/Flight/Readouts/Orbital/SpeedAtApoapsis.cs#L53-L62 Link to comment Share on other sites More sharing options...
Padishar Posted March 10, 2016 Share Posted March 10, 2016 (edited) Also, if you don't want to write it all out then you could just use: double speed = orbit.getOrbitalSpeedAtDistance(orbit.ApR); ...which also just uses the vis-viva equation... Edit: though you should check how that behaves when there is no Ap and a general check for a NaN return value would be a good idea too... Edited March 10, 2016 by Padishar Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now