Hi! Im trying to create a glider. Im strullging working with speeds and stalls and im now debating if my approach is even viable. Currently I use an Angular Velocity and Linear Velcoity and those are paired with the following functions:
local function calculateManuverability(Delta)
print(Delta)
local zTurn = (exponetial(Delta.X) * controlValues.Roll) * controlValues.sensitivity --roll
local yTurn = math.asin(myPlane.PrimaryPart.CFrame.RightVector.Y) * controlValues.TurnFactor --yaw
local xTurn = (exponetial(Delta.Y) * controlValues.Pitch) * controlValues.sensitivity --pitch
spring.Target = Vector3.new(xTurn, yTurn ,-zTurn)
end
local function calculateSpeed()
local lookVector = MainPart.CFrame.LookVector
local dotProduct = (lookVector:Dot(-Vector3.yAxis)) / 2 - 0.05 --Cosnt.1: Decel Factor , Const.2: Shifting dotproduct for level flight decel
local currentSpeed = MainPart.LinearVelocity.VectorVelocity.Z
local newSpeed = currentSpeed + (-dotProduct * controlValues.acceleration)
print(dotProduct)
return Vector3.new(0,0,math.clamp(newSpeed, -25, 0))
end
How can I make the aircraft loose altitiude at slower speeds and pitch down in a stall.
Should I even be using this method? Please let me know.
Hi! So by what Im seeing, you’re trying to implement semi realistic airplane physics. I can only reccomend for the velocity of the aircraft.
Real aircraft speed works on a balance between thrust and drag. Drag can be calculated using the drag equation ( theres a lot of stuff on the internet).
For the angle at which the plane stalls, most realistic video games use airfoil data, which gives you drag data based on the angle your airplane.
But as for my reccomendation, Id say for a glider realistic physics arent really necessary. I would reccomend just choosing a stall angle and a speed of deecelaration (like at 60 degrees the plane should be deaccelerating at -5 sttuds p/second) and making the plane harder to control at lower speeds.
Sorry if I couldnt include any images, im on mobile right now!
For pitching down during a stall, you could make the angular velocity have a constant value that tries to bring the nose down, while the velocity of the glider could mitigate this effect.
Im not really experienced with linear velocity andf forces, but by what Ive read, vectorforce provides a constant acceleration, which wouldnt really be useful. I dont exactly know which one is more realistic, but you should test them out for a bit more info.