I am trying to switch between two modes / flight and taxi for an airplane. The problem is I don't want a special key for it. Once the plane speed is over, say, 10, flight mode kicks off. Then, when I return to ground and speed down, once the speed is smaller than 10 the taxi mode should be enabled. The script I made does just that. Only once I complete the routine once - taxi - flight - taxi again - I cannot take off once more. The second it reaches speed 10, it hicks up and resets the speed to zero. I noticed this also happens sometimes from the start, but it manages to get over that moment and take off. Any help is appreciated, thanks!
var speed = rigidbody.velocity.magnitude * 2.237;
Debug.Log("speed" + speed);
if (speed >= 10 && !toggleTaxi) {
toggleTaxi = !toggleTaxi;
taxiOn();
}
else if (speed <= 10 && toggleTaxi) {
toggleTaxi = !toggleTaxi;
taxiOff();
}
↧