Help with 2D flight physics

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By googyflip

Hi, after a bit of advice or signposting to info to help with a (basic) flight physics question. Looking to re-create Biplanes (Amiga game) which has a side on small plane sprite (rigidbody2D) that has 4 controls of accelerate, decelerate, pitch up & pitch down.

I’ve done some basic implementation of thrust and torque etc. and the sprite does ‘fly’ in a fashion, but obviously displays no real or pseudo-flight characteristics. Ideally want something resembling flight for take-off speed, lift and stalling etc.

Looking for a bit of advice on sort of code to implement for this or signposting to any useful resources etc.

Thanks

G

Example Youtube video of original game

:bust_in_silhouette: Reply From: Jason Swearingen

I have not played the game you are referencing, but Something to try:

Include a gravity vector on your player, force in the downward direction of -9.8. Verify gravity “works” (increases over time) before continuing.

put the player on the ground. player should not fall under the ground. So setup collision detection and response properly

next work on “takeoff”: modify gravity based on speed

  • when player is at zero speed, gravity is full force.
  • when player is at “idle” speed, gravity is 0
  • and interpolate gravity between the two speeds.
  • i guess if you want lift, have gravity be negative above idle speed

for stall simulation, have the plane’s forward vector rotate towards it’s current velocity vector. change the speed of rotation by the velocity (so, faster plane rotates faster towards it’s current velocity vector, slower plane rotates slower)

hope that helps.