Nivekk / KOS

Fully programmable autopilot mod for KSP.
Other
80 stars 30 forks source link

Add prograde and retrograde for surface velocity #163

Open jbru opened 10 years ago

jbru commented 10 years ago

Currently the prograde and retrograde are only available for orbit velocity, you can't for example set steering to the surface retrograde of a planet to kill the relative velocity for landing.

The current implementation uses Vessel.orbit.GetVel() for the orbit velocity, you can just clone both keywords and use Vessel.GetSrfVelocity() for the surface velocity.

Dunbaratu commented 10 years ago

You can set steering to a vector. And while there aren't Euler rotations for surface prograde and retrograde, there ARE velocity vectors for it.

This for example, works:

lock steering to mySteer.
set mySteer to R(0,0,0) + velocity:surface.

If scalar times vector finally works now in 0.85, then you should be able to get the retrograde by doing this:

set mySteer to R(0,0,0) + ( velocity:surface * (0-1) ).

(multiply surface velocity by scalar negative 1).

This isn't a good enough reason to avoid putting the Euler rotations in there as well, but it can work as a temporary workaround until it's there.