From Kerbal Space Program Wiki
Jump to: navigation, search
This page is an orphan, as no other articles link to it.

A class related to processing user flight control inputs. In particular, it lets you register a function to be called once per physics frame that can modify the flight control inputs.

Useful members

Note: this is not a complete listing of the class's members. It includes only the members that someone has figured out how to use and written an explanation for. If you figure out what the other members that aren't listed here do, you should add them to the list!

void SetNeutralControls() Sets all the control inputs to "neutral" values. This is particularly useful for setting the throttle to zero when you finish some autopilot function and want to return control to the user. You can't do this by just setting s.mainThrottle = 0 in your fly-by-wire callback (see below) because that just overrides the user's throttle setting, which may be nonzero, for one frame.
static FlightInputHandler.FlightInputCallback OnFlyByWire This lets you register a function to get called each physics frame that will be able to modify the flight inputs. An autopilot for example will want to do this. Usage:

FlightInputHandler.OnFlyByWire += new FlightInputHandler.FlightInputCallback(myFlyByWire);

where myFlyByWire is looks like

void myFlyByWire(FlightCtrlState s) { //code }

Within myFlyByWire you can modify the flight inputs by setting the fields of s. s will already contain the user's inputs for pitch, yaw, roll, etc., so you can leave them as-is, filter them, or override them completely, as you choose.

bool rcsLock Whether RCS is enabled; this bool corresponds to the "RCS" light near the navball that the user by default toggles with the "r" key.