Here are two Funky Trees code snippets in SimplePlanes to control a quadcopter:-
1. Auto balance control code
Applied to the rotator that controls the fans to help the drone balance itself according to pitch and roll.
clamp(Pitch * 2 + Roll * 2, -1, 1)
Explanation:
Pitch * 2 helps balance front/back.
Roll * 2 helps balance left/right.
clamp(..., -1, 1) keeps the value in the range [-1, 1] to avoid excessive deviation
Depending on the position of each motor, you can reverse the + or - sign like:
clamp(-Pitch * 2 + Roll * 2, -1, 1)
clamp(Pitch * 2 - Roll * 2, -1, 1)
clamp(-Pitch * 2 - Roll * 2, -1, 1)
2. Manual forward, backward, left, right control code
Throttle + (Pitch * 0.5) + (Roll * 0.5)
Throttle: Controls up/down flight.
Pitch, Roll: Move forward/backward or left/right.
The coefficient of 0.5 makes it smoother, you can increase it if you need stronger feedback.
How to use:
Go to the Rotator settings (or Engine if you use it).
In the Input section, paste the corresponding code.
Depending on the position of each fan blade, you must adjust the + or - sign to be symmetrical, for example:
If you want me to combine all the control formulas into a detailed table for easier application, I will do it for you.
All of them from chat GPT, nice
@Axartar I only use it occasionally if I need a command to use in editing the build 😅
chatgpt does it quite nicely although I had to basically teach it funky trees with like 4000 examples
it works though lmao
i wouldnt recommend using chatGPT