I need help with my airplane script. my airplane wont move at all so can anyone see the problem with it
var throttle : int = 0;
var currentSpeed : float = 0.00;
var maxSpeed : float = 0.00;
var maxAltitude : float = 100.00;
var currentAltitude : float = 0.00;
var gravity : float = 200.0;
private var moveDirection : Vector3 = Vector3.zero;
var aircraftCtrl : CharacterController;
function Start(){
maxSpeed = calculateMaxSpeed(throttle);
}
function Update(){
currentAltitude = transform.position.y;
// Listen for input key entry
if(Input.GetButtonDown("ThrottleUp"))
{
if(throttle < 10)
{
throttle++;
}
maxSpeed = calculateMaxSpeed(throttle);
}
if(Input.GetButtonDown("ThrottleDown"))
{
if(throttle > 0)
{
throttle--;
}
maxSpeed = calculateMaxSpeed(throttle);
}
if(currentSpeed < maxSpeed)
{
currentSpeed = currentSpeed + 0.05;
}
if(currentSpeed > maxSpeed)
{
currentSpeed = currentSpeed - 0.02;
}
if(currentSpeed > 40)
{
maxAltitude = 2 * (throttle * 10);
}
else
{
maxAltitude = 1.00;
}
if(currentSpeed > 3 && currentSpeed < 40)
{
moveDirection.y -= (gravity / 100) * (Time.deltaTime / 50);
aircraftCtrl.Move(moveDirection * (Time.deltaTime / 30));
}
if(currentSpeed > 40 && currentAltitude <= maxAltitude)
{
moveDirection.y = gravity * (Time.deltaTime / 5);
aircraftCtrl.Move(moveDirection * (Time.deltaTime / 3));
}
Move function(){
moveDirection.x = (currentSpeed * (Time.deltaTime)) * 3;
aircraftCtrl.Move(moveDirection * Time.deltaTime);
}
print("Throttle Position: " + throttle + " Current Speed: " + currentSpeed +
" Max Altitude: " + maxAltitude + " Altitude: " + currentAltitude + " Gravity: " +
moveDirection.y);
}
function calculateMaxSpeed(throttle)
{
if(throttle == 0)
{
maxSpeed = 0.00;
}
else
{
maxSpeed = throttle * 10;
}
return maxSpeed;
}