C# Class CreatureFlightPhysics, Unity-Free-Flight

Flight Mechanics is responsible for converting user input into manipulating the wing for various physics effects. It handles the math behind flapping, flarring, and diving to change how physics effects the flight object. It does NOT directly interact with the user, ever. Instead, it's intended that the main free flight script pass in all user input, and call methods from here through Fixed Update()
Inheritance: FreeFlightPhysics
Mostrar archivo Open project: NickolausDS/Unity-Free-Flight Class Usage Examples

Protected Properties

Property Type Description
currentFlapTime float
isFlapping bool

Public Methods

Method Description
CreatureFlightPhysics ( Rigidbody rb ) : System.Collections
directionalInput ( float bank, float pitch, float sensitivity ) : void
execute ( CreatureFlightPhysics controller ) : void
flap ( float minFlapTime, float regFlapTime, float flapStrength, float downBeatStrength, bool regFlap, bool quickFlap ) : void

Try to execute a flap. A regular flap can only happen in regular intervals determined by regFlapTime. A quickFlap is faster, and can happen in minFlapTime intervals or regular flaptime intervals. If we are not flapping, and the wings are open, we are guaranteed a flap.

thrust ( float forceNewtons ) : void
wingFold ( float left, float right ) : void

Private Methods

Method Description
getAOAForZeroLCOF ( ) : float

Method Details

CreatureFlightPhysics() public method

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

directionalInput() public method

public directionalInput ( float bank, float pitch, float sensitivity ) : void
bank float
pitch float
sensitivity float
return void

execute() public method

public execute ( CreatureFlightPhysics controller ) : void
controller CreatureFlightPhysics
return void

flap() public method

Try to execute a flap. A regular flap can only happen in regular intervals determined by regFlapTime. A quickFlap is faster, and can happen in minFlapTime intervals or regular flaptime intervals. If we are not flapping, and the wings are open, we are guaranteed a flap.
public flap ( float minFlapTime, float regFlapTime, float flapStrength, float downBeatStrength, bool regFlap, bool quickFlap ) : void
minFlapTime float Minimum flap time.
regFlapTime float Reg flap time.
flapStrength float Flap strength.
downBeatStrength float
regFlap bool
quickFlap bool If set to true quick flap.
return void

thrust() public method

public thrust ( float forceNewtons ) : void
forceNewtons float
return void

wingFold() public method

public wingFold ( float left, float right ) : void
left float
right float
return void

Property Details

currentFlapTime protected_oe property

protected float currentFlapTime
return float

isFlapping protected_oe property

protected bool isFlapping
return bool