108 else if (rat <= -1.0)
111 bank = 57.3 * asin(rat);
123 float curdir = atan2(vel.x, -vel.z) * 57.295779513082;
124 float want_bank = curdir - (float)
heading;
125 if (want_bank < -180.0)
127 want_bank = want_bank * 2.0;
128 if (want_bank > 45.0)
130 if (want_bank < -45.0)
132 val = (bank - want_bank) / 100.0;
142 if (error_heading > 1.0)
144 if (error_heading < -1.0)
145 error_heading = -1.0;
147 if (offcourse_tolerance > 60.0)
148 offcourse_tolerance = 60.0;
151 float curdir = atan2(vel.x, -vel.z) * 57.295779513082;
152 float want_bank = curdir - intercept_heading;
153 if (want_bank < -180.0)
155 want_bank = want_bank * 2.0;
156 if (want_bank > 45.0)
158 if (want_bank < -45.0)
160 val = (bank - want_bank) / 100.0;
181 float wanted_vs = (float)
vs / 196.87;
191 wanted_vs = 5000.0 / 196.87;
192 float wanted_vs2 = (-ch + oh) / 5.0;
193 if (wanted_vs2 < -wanted_vs)
194 wanted_vs2 = -wanted_vs;
195 if (wanted_vs2 > wanted_vs)
196 wanted_vs2 = wanted_vs;
197 val = (wanted_vs2 - current_vs) / 40.0 + pitch_var / 40.0;
205 val = (wanted_vs - current_vs) / 40.0 + pitch_var / 40.0;
214 float wanted_alt = (float)
alt * 0.3048;
217 wanted_vs = -wanted_vs;
218 float wanted_vs2 = (wanted_alt - current_alt) / 8.0;
219 if (wanted_vs2 < -wanted_vs)
220 wanted_vs2 = -wanted_vs;
221 if (wanted_vs2 > wanted_vs)
222 wanted_vs2 = wanted_vs;
223 val = (wanted_vs2 - current_vs) / 40.0 + pitch_var / 40.0;
248 float sea_level_pressure = 101325;
250 float airpressure = sea_level_pressure * pow(1.0 - 0.0065 * altitude / 288.15, 5.24947);
251 float airdensity = airpressure * 0.0000120896;
255 float spd = gspd * sqrt(airdensity / 1.225);
257 if (spd > (
float)
ias)
258 val = val - dt / 15.0;
259 if (spd < (
float)
ias)
260 val = val + dt / 15.0;
349 if (height < 10 && last_gpws_height > 10)
351 if (height < 20 && last_gpws_height > 20)
353 if (height < 30 && last_gpws_height > 30)
355 if (height < 40 && last_gpws_height > 40)
357 if (height < 50 && last_gpws_height > 50)
359 if (height < 100 && last_gpws_height > 100)
370 if (yVel * 10.0f < -height && yVel < -10.0f)
381 float closest_hdist = -1;
382 float closest_hangle = -90;
383 float closest_vdist = -1;
384 float closest_vangle = -90;
388 for (
size_t i = 0; i < localizers.size(); i++)
390 Plane hplane = Plane(Vector3::UNIT_Y, 0);
391 Vector3 plocd = hplane.projectVector(localizers[i].rotation * Vector3::UNIT_Z);
392 float loc = atan2(plocd.z, plocd.x);
393 Vector3 posd = hplane.projectVector(position - localizers[i].position);
394 float dir = atan2(posd.z, posd.x);
395 float diff = (dir - loc) * 57.295779513082;
400 if (diff < 80 && diff > -80)
403 float dist = (localizers[i].position - position).length();
407 if (closest_hdist < 0 || closest_hdist > dist)
409 closest_hdist = dist;
410 closest_hangle = diff;
420 if (closest_vdist < 0 || closest_vdist > dist)
422 Vector3 normv = (localizers[i].rotation * Vector3::UNIT_Z).crossProduct(Vector3::UNIT_Y);
423 Plane vplane = Plane(normv, 0);
424 float glideslope = 4;
425 Vector3 posd2 = vplane.projectVector(position - localizers[i].position);
426 float d = posd2.length();
436 dir2 = asin(d) * 57.295779513082;
437 float diff2 = dir2 - glideslope;
438 closest_vdist = dist;
439 closest_vangle = diff2;
462 if (closest_hdist < 20.0 || closest_vdist < 20.0)
Central state/object manager and communications hub.
Game state manager and message-queue provider.
Core data structures for simulation; Everything affected by by either physics, network or user intera...
#define SOUND_PLAY_ONCE(_ACTOR_, _TRIG_)
int toggleHeading(int mode)
float m_ils_runway_distance
void setInertialReferences(node_t *refl, node_t *refr, node_t *refb, node_t *refc)
float m_ils_runway_heading
void gpws_update(float spawnheight)
bool m_vertical_locator_available
bool m_horizontal_locator_available
void setForceDisabled(bool disabled)
float getThrottle(float thrtl, float dt)
const TerrainPtr & GetTerrain()
TerrainObjectManager * getObjectManager()
float getHeightAt(float x, float z)
LocalizerVec & GetLocalizers()
float GetStaticWaterHeight()
Returns static water level configured in 'terrn2'.
@ SS_TRIG_GPWS_APDISCONNECT
std::vector< Localizer > LocalizerVec
SoundScriptManager * GetSoundScriptManager()
GameContext * GetGameContext()
Physics: A vertex in the softbody structure.
Ogre::Vector3 AbsPosition
absolute position in the world (shaky)
Ogre::Vector3 RelPosition
relative to the local physics origin (one origin per actor) (shaky)