Thursday, April 6, 2017

physics - A simple flight simulator


In a 3D flight simulator with a Crimson Skies level of realism (as in, arcade level rather than realistic), how do you determine the movement of an aircraft each game clock tick?


(Crimson Skies is an arcade-like flight simulator: http://youtu.be/OWmYt0LZDnU?t=3m )


I presume the game advances in fixed steps, and each step each moving object moves in a straight line with constant velocity from its current position to the next.


What basic parameters would you need to determine the mass, speed, throttle .etc. Also how would you combine them?



Answer




To understand how to simulate aerodynamic flight, one first has to understand which forces affect the movement of an aircraft. The actual trajectory of an aircraft is the sum of all of these physical effects:




  1. An object moves at a constant velocity, unless acted upon by a force.

  2. The acceleration of a body is directly proportional to, and in the same direction as, the net force acting on the body, and inversely proportional to its mass. Thus, F = ma, where F is the net force acting on the object, m is the mass of the object and a is the acceleration of the object.



The thrust of the engine is a force which accelerates an aircraft forward and usually can be controlled by the player. The acceleration is the power of the engine divided by the mass of the aircraft.



Gravity constantly accerates an aircraft downwards with a speed of 9,81 m/s². In theory, gravity becomes less when you go higher, but at the height where normal aircrafts operate, this can be ignored.




The faster an aircraft moves, the more does atmospheric friction slow it down. This is represented by a force accelerating in a direction against the current direction the craft is moving. The force increases quadratical with the speed (double speed = four times the drag force). But the higher the aircraft is flying, the thinner the atmosphere and the lower the drag-force. The maximum speed of an aircraft is where the forces generated by engine thrust and aerodynamic drag cancel each other out.


It might sound counter-intuitive, but having a stronger drag-constant will actually make your game easier to play (more arcade-like), because drag is the force which stops the plane from flying into the direction the player doesn't want to fly anymore (like when flying a curve). So more drag = slower and more maneuverable planes. You can further improve this by increasing the drag when there is a difference between the heading-direction and the movement-direction of the plane (this isn't even unrealistic - the aerodynamic profile of a plane is optimized for least air resistance when the plane is flying straight).



This is the force which actually causes a plane to fly. It is generated by the wings. The larger the wing surface, the more lift is generated, and accelerates the plane upwards (relative to the wings, not the ground. When the plane rolls sideways, the lift is accelerating it sideways, too). Just like the atmospheric drag, the lift is relative to speed and atmospheric density.



A plane controls its direction with different control surfaces for pitch, yaw and roll. A control surface only works when the plane is moving. Its efficiency is proportional to the current speed and atmospheric density. Note that control surfaces only change the direction in which the plane is pointing, not the direction it is moving. This affects the direction of thrust and lift, and thus gradually the movement direction.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...