- // Lift the plane up so the gear clear the ground
- float minGearZ = 1e18;
- for(i=0; i<a->numGear(); i++) {
- Gear* g = a->getGear(i);
- float pos[3];
- g->getPosition(pos);
- if(pos[2] < minGearZ)
- minGearZ = pos[2];
+ // Are we at ground level? If so, lift the plane up so the gear
+ // clear the ground
+ if(get_Altitude() - get_Runway_altitude() < 50) {
+ float minGearZ = 1e18;
+ for(i=0; i<a->numGear(); i++) {
+ Gear* g = a->getGear(i);
+ float pos[3];
+ g->getPosition(pos);
+ if(pos[2] < minGearZ)
+ minGearZ = pos[2];
+ }
+ _set_Altitude(get_Runway_altitude() - minGearZ*M2FT);