Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lock steering to heading(-90,180).
- set throt to 0.
- lock throttle to throt.
- set expo to abs(ln(5/1000) / ln(ship:periapsis / ship:apoapsis)). //sets an exponent used in the throttle control such that 1000 * the ratio of my periapsis to apoapsis to that power will start out at 5, and exponentially grow towards 1000 as the ratio approaches 1.
- until ship:periapsis / ship:apoapsis > 0.999999 {
- set deta to (eta:periapsis - (ship:orbit:period / 2)). //little trick I came up with the get the distance in seconds to or from apoapsis. If you pass apoapsis, you get a negative number in seconds that have passed since reaching apoapsis!
- set base to max(0.0001,(-(2.924 * (ship:periapsis / ship:apoapsis))^1.5 + 5)). //'base' is the mean value of the sigmoid function, or the x value that the s-curve centers on. The function always tries to stay at the mean value, adjusting its output between 0 and 1 in order to do so. This function basically just "slides" the mean value along the x-axis towards 0 as the ratio of Pe and Ap approaches 1 so that just before being perfectly circular, the sigmoid function will be adjusting the throttle in order to try to keep the time to apoapsis at 0.0001.
- set throt to -1 / (1 + (1000 * (ship:periapsis / ship:apoapsis)^expo)^(base - deta)) + 1. //this is the sigmoid function. The standard sigmoid takes the form 1/(1+e^(-x)). The variables in my function just transform it in certain ways.
- wait 0.
- }
Add Comment
Please, Sign In to add comment