I don't know anything about FunkyTrees but can somebody who does have knowledge tell me if this would work? It was AI generated by ChatGPT.
// Fly-by-wire system parameters
float maxControlSurfaceAngle = 30.0; // Maximum control surface deflection in degrees
float pitchSensitivity = 1.0; // Pitch control sensitivity
float rollSensitivity = 0.8; // Roll control sensitivity
float yawSensitivity = 0.6; // Yaw control sensitivity
// Rate limiting for smooth response (in degrees per second)
float maxPitchRate = 10.0; // Max pitch rate (degrees per second)
float maxRollRate = 10.0; // Max roll rate (degrees per second)
float maxYawRate = 5.0; // Max yaw rate (degrees per second)
// Control surfaces
var elevator = part("elevator"); // Elevators
var ailerons = part("aileron"); // Ailerons
var rudder = part("rudder"); // Rudder
// Input from controls (throttle, pitch, roll, yaw)
float pitchInput = input.getAxis("Pitch"); // User input for pitch
float rollInput = input.getAxis("Roll"); // User input for roll
float yawInput = input.getAxis("Yaw"); // User input for yaw
// Function to limit input values to a given range
function limitControl(input, maxLimit) {
if (input > maxLimit) {
return maxLimit;
} else if (input < -maxLimit) {
return -maxLimit;
}
return input;
}
// Apply fly-by-wire logic to control surfaces
function applyFlyByWire() {
// Calculate the desired control surface angles
float desiredPitchAngle = pitchInput * maxControlSurfaceAngle * pitchSensitivity;
float desiredRollAngle = rollInput * maxControlSurfaceAngle * rollSensitivity;
float desiredYawAngle = yawInput * maxControlSurfaceAngle * yawSensitivity;
// Smooth control by limiting the rate of change for each control surface
float currentPitchAngle = elevator.angle();
float currentRollAngle = ailerons.angle();
float currentYawAngle = rudder.angle();
// Apply rate limiting to each control surface
float pitchRate = (desiredPitchAngle - currentPitchAngle) * maxPitchRate;
float rollRate = (desiredRollAngle - currentRollAngle) * maxRollRate;
float yawRate = (desiredYawAngle - currentYawAngle) * maxYawRate;
// Limit the control surface deflection rates to the max rates
pitchRate = limitControl(pitchRate, maxPitchRate);
rollRate = limitControl(rollRate, maxRollRate);
yawRate = limitControl(yawRate, maxYawRate);
// Apply the calculated rates to control surfaces
elevator.setAngle(currentPitchAngle + pitchRate);
ailerons.setAngle(currentRollAngle + rollRate);
rudder.setAngle(currentYawAngle + yawRate);
}
// Main loop to update control surfaces
applyFlyByWire();
Uhh... no. Not even slightly. First off, that seems to be Javascript-adjacent, which is not similar to Funky Trees, and second, even if it was, you can't just say stuff like part("rudder") and expect SP to know what you're talking about. That's not how it works.
Here's a tip: Don't use AI for Funky Trees. Just don't. Learning to do it yourself is way more satisfying (and really not all that complicated once you get the hang of it), and you can actually say that you know what your code does instead of relying on an AI that doesn't know what Funky Trees even is. There's plenty of guides, references, and people who'd be willing to help.
@StarcrestUnited happy to help😀
@JBPAviation alright thank you for the clarification
Try this and figure it out yourself
No
A lot of those terms don't even exist in funky trees