KSP-KOS / KOS

Fully programmable autopilot mod for KSP. Originally By Nivekk
Other
691 stars 229 forks source link

Support all 6 aiming points. #509

Open Dunbaratu opened 9 years ago

Dunbaratu commented 9 years ago

I propose we add these directions

Possibly we should add SRF versions of them as well (as they will rotate slightly when converted into the surface-relative frame if you're not traveling in an equatorial path.).

These would all be very easy one-liner calculations, and in fact are already easy calculations in kerboscript but there's no real reason to make things more obfuscated than they need to be by hiding them and forcing people to get them from cross-products.

Rationale:

I was thinking when KSP 0.90 came out about the new aiming points on the navball - (anti)normal, radial (in/out) - and how you need a good updated probe core before you can access all of them (the early cores can't, just like a low-experience meat pilot can't).

It seemed the right thing to do is just add these to kOS, but In trying to make kOS adhere to the theming of KSP 0.90 I was thinking it wouldn't be right to always allow scripts to access these points if the probe core can't do them.

Here's why I waffled on this: If you disallow the NAMED points, you're not really preventing the kOS script from using them - just demanding that the script do an additional math operation. Once you have SHIP:PROGRADE and SHIP:UP then the remaining other 4 directions are calculable anyway in script code: Normal is the cross product of the two. Antinormal is (-1)normal. radial out is just another word for SHIP:UP and radial in is therefore just (-1)SHIP:UP.

And even if you deny use of SHIP:UP, because that's really radial out, you can still calculate it as the opposite direction of BODY:POSITION. If you deny use of SHIP:PROGRADE you can still calculate it as the direction of `ship:velocity:orbit which even if you deny that you can still calculate it from watching your delta position over delta time. (or, more accurately from the BODY's delta position because we coerce all positions to be origined at the ship.)

The point is that the only way to prevent kos scripts from getting all 6 points before it's really ready in the tech tree would be to deny them really basic info about everything and rendering the script useless.

Therefore we may as well just say "screw it" and accept that this is one way in which kOS breaks the assumptions about KSP 0.90 and actually makes a thing easier than KSP does.

erendrake commented 9 years ago

I agree completely, they are already 'available' to scripters so making it more complicated is only accomplishing making it more complicated :)

That might be the first time someone has said that kOS makes things easier.

dewiniaid commented 8 years ago

Note ship:radialout (as defined by the Navball) is not quite the same ship:up -- the two only coincide on a perfectly circular orbit or Ap/Pe where vertical acceleration is 0.

Prograde is velocity. Normal is the cross product of Prograde and Up. Radial is perpendicular to Prograde along the Normal plane; or a 90 degree rotation of the prograde vector around the normal vector.