Wing going unreasonably fast upwards

Working on a wing simulation and I was using this lift equation script I made up from NASA’s website.

local runservice = game:GetService("RunService")

runservice.Heartbeat:Connect(function()
	local v2 = script.Parent.AssemblyLinearVelocity.Magnitude ^ 2
	local density = game.Lighting.airDensity.Value
	local liftCoefficient = 1
	local dragCoefficient = 1
	local lift = script.Parent.Lift
	local wingLength = script.Parent.Size.X
	local wingWidth = script.Parent.Size.Z
	local wingArea = wingLength * wingWidth
	local density2 = density * v2
	lift.Force = Vector3.new(liftCoefficient * density2 / 2 * wingArea,0,0)
end)

Here’s what happens;

If someone could help me, I would appreciate it.

Thanks,
– Luke

You should print the force and see it’s numbers. It might be that the Y is WAY to big.

Print out what @edozune said to print out, but my guess isn’t that the Y value is too big, but rather the Y value is increasing. If it is, it may have something to do with your airDensity calculation. Can you show us that?

That’s what I meant to say, of course it’s increasing but it might be increasing a bit too much or too fast. Thanks for re-wording, @xendatro.

local density2 = density * v2
	lift.Force = Vector3.new(liftCoefficient * density2 / 2 * wingArea,0,0)

Air density is a preset value in lighting.
image

Maybe try to lower your lift coefficient… its a good variable for you to test different lift forces.

Start with 0.1 and go from there.

1 Like

@edozune @xendatro you guys keep saying to reduce values on it but its decreasing the overall lift which is a big problem. I do think it has something to do with velocity ^ 2 though. But all I can say is that I can’t really decrease those other values…

What if you print the force to see what type of inputs it give?

I am little confused, what are you trying to achieve here? Also you are not applying any value on y axis instead you are doing it on x axis is that what you wish to do?

It’s a vector force according to the attachment. So X is always local and is pointing in the direction of the attachment. If you watched the video the issue is that at the end the wing goes insanely fast upwards and I think I know what is wrong, angle of attack is nowhere in the lift coefficient or equation meaning that if the wing is sideways the velocity will increase dramatically and in turn make the lift more and so on and so forth.