C# Class FreeFlightPhysics, Unity-Free-Flight

Simulate the flow of air around an airfoil. This class applies passive forces on a flight object, such as lift and drag. It only applies these forces based on the current state of the wing, but never changes the actual wing itself (so no flapping).
Inheritance: FlightObject
Datei anzeigen Open project: NickolausDS/Unity-Free-Flight Class Usage Examples

Public Properties

Property Type Description
dragEnabled bool
gravityEnabled bool
liftEnabled bool

Protected Properties

Property Type Description
rigidbody UnityEngine.Rigidbody

Public Methods

Method Description
FreeFlightPhysics ( Rigidbody rb ) : System.Collections
doStandardPhysics ( ) : void

Apply the regular flight physics to the flight object. Precondition: This must be called at regular intervals to have a smooth effect on the physics object (use FixedUpdate).

getAngleOfAttack ( Quaternion theCurrentRotation, Vector3 theCurrentVelocity ) : float
getBankedTurnRotation ( Quaternion theCurrentRotation ) : Quaternion
getDirectionalVelocity ( Quaternion theCurrentRotation, Vector3 theCurrentVelocity ) : Vector3
getDrag ( float velocity, float pressure, float area, float dragCoff, float lift, float aspectR ) : float

Get the current drag force on the object based on the parameters. All dimensions must be in metric.

getDragCoefficient ( float angleDegrees ) : float
getLift ( float velocity, float pressure, float area, float liftCoff ) : float

Get the current lift force on the object based on the paramaters. All dimensions must be in metric.

getLiftCoefficient ( float angleDegrees ) : float
getStallRotation ( Quaternion curRot, float velocity ) : Quaternion

Method Details

FreeFlightPhysics() public method

public FreeFlightPhysics ( Rigidbody rb ) : System.Collections
rb UnityEngine.Rigidbody
return System.Collections

doStandardPhysics() public method

Apply the regular flight physics to the flight object. Precondition: This must be called at regular intervals to have a smooth effect on the physics object (use FixedUpdate).
public doStandardPhysics ( ) : void
return void

getAngleOfAttack() public method

public getAngleOfAttack ( Quaternion theCurrentRotation, Vector3 theCurrentVelocity ) : float
theCurrentRotation Quaternion
theCurrentVelocity Vector3
return float

getBankedTurnRotation() public method

public getBankedTurnRotation ( Quaternion theCurrentRotation ) : Quaternion
theCurrentRotation Quaternion
return Quaternion

getDirectionalVelocity() public method

public getDirectionalVelocity ( Quaternion theCurrentRotation, Vector3 theCurrentVelocity ) : Vector3
theCurrentRotation Quaternion
theCurrentVelocity Vector3
return Vector3

getDrag() public method

Get the current drag force on the object based on the parameters. All dimensions must be in metric.
public getDrag ( float velocity, float pressure, float area, float dragCoff, float lift, float aspectR ) : float
velocity float Velocity Meters/Second
pressure float Pressure (something)
area float Area Meters^2
dragCoff float Drag coff (dimensionless)
lift float Lift Newtons
aspectR float Aspect r. (dimensionless)
return float

getDragCoefficient() public method

public getDragCoefficient ( float angleDegrees ) : float
angleDegrees float
return float

getLift() public method

Get the current lift force on the object based on the paramaters. All dimensions must be in metric.
public getLift ( float velocity, float pressure, float area, float liftCoff ) : float
velocity float Velocity Meters/Second
pressure float Pressure (something)
area float Area Meters^2
liftCoff float Lift coff. (dimensionless)
return float

getLiftCoefficient() public method

public getLiftCoefficient ( float angleDegrees ) : float
angleDegrees float
return float

getStallRotation() public method

public getStallRotation ( Quaternion curRot, float velocity ) : Quaternion
curRot Quaternion
velocity float
return Quaternion

Property Details

dragEnabled public_oe property

public bool dragEnabled
return bool

gravityEnabled public_oe property

public bool gravityEnabled
return bool

liftEnabled public_oe property

public bool liftEnabled
return bool

rigidbody protected_oe property

protected Rigidbody,UnityEngine rigidbody
return UnityEngine.Rigidbody