Very simple "Aerodynamics" behavior?

Hello,
I’ve made a drivable plane, in the most basic way. I use BodyVelocity and BodyGyro put in the RootPart of the airplane.

The plane is pushed, or in the term of aerodynamics as thrust, powered by the BodyVelocity, and rotates with the use of BodyGyro. To picture it out, it works like how the planes do in the game Naval Warfare by l_11I. The airplane follows your mouse.

However, this does not satisfy me as they look unrealistic.

There are some goals I want on how the plane should work:

  1. Tilts sideways when turning. (roll) A plane wouldn’t rely on their rudder alone when rotating in the Y-axis. Pilots would tilt their planes sideways when turning.

  2. Don’t abandon gravity. When the plane pitches up, it would lose speed and eventually start to stall. The other way around. If it dives down, it would gain speeds faster than it could horizontally, and would overspeed sometime later.
    Since I use BodyVelocity here, I put MaxForces to high numbers to get the thrust to work. Thus, resulting the thrust overriding the gravity effect.

  3. Proper acceleration + responsiveness depends on throttle. In this case, the plane would be in ground phase. When I put the throttle to 10%, it would remain on 0 speeds, but will eventually reach the 10% the max speed put on the plane, in a slow pace. Now if I put the plane to 100%, it would accelerate much faster, but doesn’t immediately reach full speed.
    Currently, putting the throttle to 100% would get the plane to instantly reach the max speed as the BodyVelocity powering it has a high number of MaxForces.
    Now, from 100% to 0%, instead of slow deacceleration, it’d just reach to full stop with no efforts.

  4. (Quite off-topic) landing gear suspension. I plan to get the suspension physics to only work when the gears are not retracted. I could’ve grabbed some suspension tutorials for cars and write the rest of the code. I did, but none of them gets it to work. I also wish to get it to steer when taxiing.

Here’s a bite from the LocalScript powering the airplane:

local throttle = 0 -- Handled by UIS.Inputs.
local steer = 0 -- Also UIS.Inputs.
local state = "surface" --/"air". To tell that if the plane is flying or not.
local maxSpeed = 200
local landingSpeed = 50

while plrHum.Health > 0 and plane.Pilot.Occupant == plrHum do
	wait()
	planeRP.Thrust.Velocity = planeRP.CFrame.LookVector * throttle * maxSpeed

	if speed >= landingSpeed then
		state = "air"
		planeRP.Thrust.MaxForce = Vector3.new(1,0.8,1) * (10000 + (50000 * throttle))
		-- Less MaxForce on the Y-axis, attempting to achieve gravity effect. It barely works, and is wonky.

		planeRP.Gyro.MaxTorque = Vector3.new(1,1,1) * 100000

		if mouseDown == true then
			planeRP.Gyro.CFrame = CFrame.lookAt(planeRP.Position, mouse.Hit.Position)
		end
		-- As you can see here, the plane only follows the mouse when it is held down.
	else
		state = "surf"
		planeRP.Thrust.MaxForce = Vector3.new(1,0.05,1) * 13000

		planeRP.Gyro.MaxTorque = Vector3.new(0,100000000,0)
		-- An attempt to get steering to work. It does not.

		planeRP.Gyro.CFrame = planeRP.CFrame * (CFrame.Angles(0, math.rad(1.5*steer), 0))
		roll = 0
	end
	
end

So, how would I approach this? Thank you for reading.

Also, I have this unsolved issue about SFX, which impacts on the realism of airplanes.

2 Likes