Difference between revisions of "FlightInputHandler"
(Created page with "A class related to processing user flight control inputs. == Useful members == <table border="1"> <tr> <td><code>void SetNeutralControls()</code></td> <td>Sets all the contr...") |
Rocketdocker (talk | contribs) ({{Orphan}}) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | A class related to processing user flight control inputs. | + | {{Orphan}} |
+ | 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 == | == 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! | ||
<table border="1"> | <table border="1"> | ||
Line 21: | Line 24: | ||
</td> | </td> | ||
</tr> | </tr> | ||
+ | <tr> | ||
<td><code>bool rcsLock</code></td> | <td><code>bool rcsLock</code></td> | ||
<td>Whether RCS is enabled; this bool corresponds to the "RCS" light near the navball that the user by default toggles with the "r" key.</td> | <td>Whether RCS is enabled; this bool corresponds to the "RCS" light near the navball that the user by default toggles with the "r" key.</td> | ||
</tr> | </tr> | ||
</table> | </table> |
Latest revision as of 15:43, 22 January 2020
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. |