I have the basic 4 force properties for an aerocraft sorted (lift, gravity, thrust, drag)
, but I’m not sure how to perform turns and how to calculate lift properly.
Every frame, the plane’s LinearVelocity object, which is at the centre of the aerocraft, is accelerated to the forward / look vector by [(thrust - drag) / mass * deltaTime]
and is accelerated along the Y axis by [(lift - gravity) / mass * deltaTime]
. Once the fuel of the aerocraft runs dry, the acceleration from the thrust force goes down to 0.
I’ve used ChatGPT to calculate drag and lift, but I don’t know how accurate it would be.
Here are the list of functions I use for my current system:
Getting air density from altitude:
function air_density(altitude:number)
local pressure = 101325 * (1 - 2.25577e-5 * altitude) ^ 5.25588
local temperature = 288.15 - 0.0065 * altitude
return pressure / (287.05 * temperature)
end
Getting lift force from lift co-effiecent, altitude, wing area and velocity:
function lift(lift_coE, altitude, wingArea, velocity)
return (lift_coE * air_density(altitude) * wingArea * velocity ^ 2) * 0.5
end
Getting drag from drag co-effiecent, air density and velocity:
function drag(cD,rho, V)
return 0.5 * 15 * rho * (V ^ 2)
end
However I haven’t found an effective method to get a lift and drag co-effiecents from angle of attack of the wings of the aerocraft, which means that the co-effiecents are fixed values, making a lot of the plane’s movements limited.
I’ve tried to use ChatGPT to get calculations for the co-effiecents, but I never got a straight-forward answer.
If anyone got a method for how to get them, and how to improve my existing system, please help!