ABOUT DOCUMENTATION
In engineering, there is a practice called documentation, in which the engineer records their work/progress. This is an extremely useful practice, as it allows for that engineer to effectively share and remember their work. This post is mostly for my memory, but you may use this code to design some fancy VTOL systems.
RULES ABOUT USAGE
If you do wish to use this code, please take a few simple steps to credit me, and to let me see what you create! To provide proper credit, all you have to do is to mention me in the description. Anything along the lines of "Credit for spefyjerbf for the flight system code" will suffice. Also, please tag me in your aircraft's comments so I can try it out! While these steps may not be entirely required by the website rules, I would appreciate it - I did spend a few hours making this system!
CONTROLS
Pitch: Forward (Longitudinal) motion
Roll: Lateral motion
Throttle: Engines online
VTOL: Ascent/descent mode:
- VTOL down to descend
- VTOL up to ascend
- VTOL center to hover
Activator 1: Quadruple ascent/descent speed
Activator 2: Fine-Maneuver mode (automatically zeros horizontal motion!)
Activator 3: Cruise mode (Constantly fires forward-facing engines for a fast cruise)
VERTICAL MOTION CONTROL
Part: VTOL engine. VTOL nozzles should be placed to face downward at all times.
Code: Already documented.
HORIZONTAL MOTION CONTROL
Part: Any small 1x1 jet engine
Code: Listed below in FOUR sections
BACKWARD JET: clamp(-1 * Pitch * (1 - clamp01(Activate2)), 0, 0.01) + clamp01(Activate2) * (-0.0075 * clamp(Pitch, -1, 0) + 0.0025 * clamp01(GS * cos(AngleOfAttack) * cos(AngleOfSlip)) * clamp01(sign(cos(AngleOfAttack)) + 1))
FORWARD JET: clamp(Pitch * (1 - clamp01(Activate2)), 0, 0.01) + clamp01(Activate2) * (0.0075 * clamp01(Pitch) + 0.0025 * -1 * clamp(-1 * GS * cos(AngleOfAttack) * cos(AngleOfSlip), -1, 0) * clamp01(-1 * sign(cos(AngleOfAttack))))
RIGHT JET: clamp(-1 * Roll * (1 - clamp01(Activate2)), 0, 0.01) + clamp01(Activate2) * (-0.0075 * clamp(Roll, -1, 0) + 0.0025 * clamp01(GS * abs(sin(AngleOfAttack)) * clamp01(sin(AngleOfSlip))))
LEFT JET: clamp(Roll * (1 - clamp01(Activate2)), 0, 0.01) + clamp01(Activate2) * (0.0075 * clamp(Roll, 0, 1) + 0.0025 * clamp01(GS * abs(sin(AngleOfAttack)) * clamp01(-1 * sign(sin(AngleOfSlip)))))