private void FixedUpdate() { // Read input for the pitch, yaw, roll and throttle of the aeroplane. float roll = CrossPlatformInputManager.GetAxis("Horizontal"); float pitch = CrossPlatformInputManager.GetAxis("Vertical"); bool airBrakes = CrossPlatformInputManager.GetButton("PowerDown"); // auto throttle up, or down if braking. //float throttle = airBrakes ? -1 : 1; #if MOBILE_INPUT AdjustInputForMobileControls(ref roll, ref pitch, ref throttle); #endif if (Input.GetButton("PowerUp") && throttle < throttleMax) { throttle += 0.02f; } if (Input.GetButton("PowerDown") && throttle > -throttleMax) { throttle -= 0.02f; } // Pass the input to the aeroplane //Debug.Log(throttle); //スロットル //Debug.Log(m_Aeroplane.ForwardSpeed); //速度(10以下で失速) m_Aeroplane.Move(roll, pitch, 0, throttle, airBrakes); //移動 }
private void FixedUpdate() { // Read input for the pitch, yaw, roll and throttle of the aeroplane. float roll = Input.GetAxisRaw("Joy" + yoke + "Axis1"); float pitch = (-1) * Input.GetAxisRaw("Joy" + yoke + "Axis2"); m_AirBrakes = CrossPlatformInputManager.GetButton("Fire1"); m_Yaw = (-1) * Input.GetAxisRaw("Joy" + pedals + "Axis3"); m_Throttle = (((-1) * Input.GetAxisRaw("Joy" + yoke + "Axis3"))); float airBrakes = (Input.GetAxisRaw("Joy" + pedals + "Axis1")); if (airBrakes < 0) { m_AirBrakes = false; } else { m_AirBrakes = true; } #if MOBILE_INPUT AdjustInputForMobileControls(ref roll, ref pitch, ref m_Throttle); #endif // Pass the input to the aeroplane m_Aeroplane.Move(roll, pitch, m_Yaw, m_Throttle, m_AirBrakes); //Debug.Log("Roll out:\t" +roll); //Debug.Log("Pitch Perfect:\t" + pitch); //Debug.Log("Yaw Yaw:\t" + m_Yaw); //Debug.Log("Many thrusts:\t" + m_Throttle); //Debug.Log("airbrakes:\t" + airBrakes); }
private void HandleMessageCar(string message) { datareceived = message; var splittedStrings = message.Split(','); if (splittedStrings.Length != 6) { return; } xRight = float.Parse(splittedStrings[0]); yRight = float.Parse(splittedStrings[1]); xRight = xRight / 1023f; yRight = yRight / 1023f; xLeft = float.Parse(splittedStrings[2]); yLeft = float.Parse(splittedStrings[3]); xLeft = xLeft / 1023f; yLeft = yLeft / 1023f; driveButtonRight = float.Parse(splittedStrings[4]); driveButtonRight = driveButtonRight / 1023f; driveButtonLeft = float.Parse(splittedStrings[5]); driveButtonLeft = driveButtonLeft / 1023f; Debug.Log("datareceived" + datareceived); m_Aeroplane.Move(xLeft, yLeft, 0, yRight, isPushed(driveButtonRight)); }
private void FixedUpdate() { // Read input for the pitch, yaw, roll and throttle of the aeroplane. float roll = Input.GetAxis("Mouse X"); float pitch = Input.GetAxis("Mouse Y"); m_AirBrakes = Input.GetButton("Fire1"); m_Yaw = Input.GetAxis("Horizontal"); m_Throttle = Input.GetAxis("Vertical"); // Pass the input to the aeroplane m_Aeroplane.Move(roll, pitch, m_Yaw, m_Throttle, m_AirBrakes); }
private void FixedUpdate() { // Read input for the pitch, yaw, roll and throttle of the aeroplane. float roll = Input.GetAxis("Horizontal"); float pitch = Input.GetAxis("Vertical"); bool airBrakes = Input.GetButton("Fire1"); // auto throttle up, or down if braking. float throttle = airBrakes ? -1 : 1; // Pass the input to the aeroplane m_Aeroplane.Move(roll, pitch, 0, throttle, airBrakes); }
private void FixedUpdate() { // Read input for the pitch, yaw, roll and throttle of the aeroplane. float roll = CrossPlatformInputManager.GetAxis("Horizontal"); float pitch = CrossPlatformInputManager.GetAxis("Pitch"); m_AirBrakes = CrossPlatformInputManager.GetButton("Fire1"); m_Yaw = CrossPlatformInputManager.GetAxis("Yaw"); m_Throttle = CrossPlatformInputManager.GetAxis("Vertical"); #if MOBILE_INPUT AdjustInputForMobileControls(ref roll, ref pitch, ref m_Throttle); #endif // Pass the input to the aeroplane m_Aeroplane.Move(roll, pitch, m_Yaw, m_Throttle, m_AirBrakes); }
private void FixedUpdate() { // Read input for the pitch, yaw, roll and throttle of the aeroplane. float roll = Input.GetAxis("Horizontal"); float pitch = Input.GetAxis("Vertical"); bool airBrakes = Input.GetButton("Fire1"); // auto throttle up, or down if braking. float throttle = airBrakes ? -1 : 1; #if MOBILE_INPUT AdjustInputForMobileControls(ref roll, ref pitch, ref throttle); #endif // Pass the input to the aeroplane m_Aeroplane.Move(roll, pitch, 0, throttle, airBrakes); }
private void FixedUpdate() { // Read input for the pitch, yaw, roll and throttle of the aeroplane. float roll = CrossPlatformInputManager.GetAxis("Horizontal"); float pitch = CrossPlatformInputManager.GetAxis("Vertical"); bool airBrakes = !(CrossPlatformInputManager.GetButton("Jump")); // auto throttle up, or down if braking. float throttle = airBrakes ? -1 : 1; Debug.Log("throttle is " + throttle + " and airBrakes is " + airBrakes); #if MOBILE_INPUT AdjustInputForMobileControls(ref roll, ref pitch, ref throttle); #endif // Pass the input to the aeroplane m_Aeroplane.Move(roll, pitch, 0, throttle, airBrakes); }
private void FixedUpdate() { // Check that player is current local player if (!isLocalPlayer) { return; } // Read input for the pitch, yaw, roll and throttle of the aeroplane. float roll = CrossPlatformInputManager.GetAxis("Horizontal"); float pitch = CrossPlatformInputManager.GetAxis("Vertical"); bool airBrakes = CrossPlatformInputManager.GetButton("Fire1"); bool boost = CrossPlatformInputManager.GetButton("Fire2"); bool shoot = CrossPlatformInputManager.GetButton("Jump"); if (shoot) { CmdFire(); } float throttle = airBrakes ? -1 : 1; //boost ? boostMultFactor : 1; // if boost is pressed and current time is > [threshold], decrease current boosting time by // deltatime. // if boost is not pressed, increase current time by deltatime * [factor] if (boost && currentBoostingTime > 0) { Debug.Log("SUPER SPEEEED"); currentBoostingTime -= Time.deltaTime; throttle = boostMultFactor; } else if (currentBoostingTime < boostDuration) { currentBoostingTime += Time.deltaTime * boostRegenFactor; } //Debug.Log("Current boost time: " + currentBoostingTime); // Pass the input to the aeroplane m_Aeroplane.Move(roll, pitch, 0, throttle, airBrakes); }
private void FixedUpdate() { if (gameObject.GetComponent <PhotonView>().isMine == false && PhotonNetwork.connected == true) { return; } // Read input for the pitch, yaw, roll and throttle of the aeroplane. float roll = CrossPlatformInputManager.GetAxis("Mouse X"); pitch = CrossPlatformInputManager.GetAxis("Vertical"); m_AirBrakes = CrossPlatformInputManager.GetButton("Fire1"); m_Yaw = CrossPlatformInputManager.GetAxis("Mouse X"); //m_Throttle = CrossPlatformInputManager.GetAxis("Mouse Y"); #if MOBILE_INPUT AdjustInputForMobileControls(ref roll, ref pitch, ref m_Throttle); #endif // Pass the input to the aeroplane m_Aeroplane.Move(0.5f * roll, 0.5f * pitch, m_Yaw, m_Throttle, m_AirBrakes); }
private void FixedUpdate() { // Read input for the pitch, yaw, roll and throttle of the aeroplane. float pitch = CrossPlatformInputManager.GetAxis("Vertical"); float roll = CrossPlatformInputManager.GetAxis("Horizontal"); float yawInput = 0; //Set back the value of roll level of aeroplaneController leftTrigger = Input.GetAxis("LeftTrigger"); rightTrigger = Input.GetAxis("RightTrigger"); leftTrigger = Mathf.Clamp(leftTrigger, 0, 1); rightTrigger = Mathf.Clamp(rightTrigger, 0, 1); if (roll < -0.3f) { var forces = Vector3.zero; forces += speedOffFallingOneWing * engineSpeedMultiplier * Vector3.down; m_Aeroplane.m_Rigidbody.AddForce(forces); //fermeture de l'aile à gauche AnimatorController.SetBool("LeftTrigger", true); AnimatorController.SetBool("RightTrigger", false); } else if (roll > 0.3f) { var forces = Vector3.zero; forces += speedOffFallingOneWing * engineSpeedMultiplier * Vector3.down; m_Aeroplane.m_Rigidbody.AddForce(forces); //fermeture de l'aile à droite AnimatorController.SetBool("RightTrigger", true); AnimatorController.SetBool("LeftTrigger", false); } else { roll = 0; //Ouvrir les ailes AnimatorController.SetBool("LeftTrigger", false); AnimatorController.SetBool("RightTrigger", false); } if (leftTrigger == 0 && rightTrigger == 0) { //Debug.Log("Chicken's floating"); //Animation des deux ailes tendues } else if (leftTrigger != 0) { yawInput = -1; var forces = Vector3.zero; forces += speedOffFallingOneWing * engineSpeedMultiplier * Vector3.down; m_Aeroplane.m_Rigidbody.AddForce(forces); //fermeture de l'aile à gauche } else if (rightTrigger != 0) { yawInput = 1; var forces = Vector3.zero; forces += speedOffFallingOneWing * engineSpeedMultiplier * Vector3.down; m_Aeroplane.m_Rigidbody.AddForce(forces); //fermeture de l'aile à droite } if (leftTrigger != 0 && rightTrigger != 0) { //Chicken's falling //Fermeture des deux ailes yawInput = 0; var forces = Vector3.zero; forces += speedOfFalling * engineSpeedMultiplier * Vector3.down; m_Aeroplane.m_Rigidbody.AddForce(forces); Quaternion from = transform.rotation; Quaternion to = Quaternion.Euler(new Vector3(0, -90, 0)); transform.rotation = Quaternion.Lerp(from, to, Time.deltaTime * stabilizationFactor); } float throttle = 1; // Pass the input to the aeroplane m_Aeroplane.Move(roll, pitch, yawInput, throttle, false); }
private void FixedUpdate() { // Read input for the pitch, yaw, roll and throttle of the aeroplane. float roll = 0; float pitch = 0; bool airBrakes = false; float throttle = -1; float yaw = 0; // roll= CrossPlatformInputManager.GetAxis("Horizontal"); // pitch= CrossPlatformInputManager.GetAxis("Vertical"); // airBrakes = CrossPlatformInputManager.GetButton("Fire1"); // roll=Input.GetAxis("joystick 1 analog 0"); if (GameInputController.Instance().GetDevice() != null) { roll = GameInputController.Instance().GetAxis("Analog0"); pitch = -GameInputController.Instance().GetAxis("Analog1"); yaw = GameInputController.Instance().GetAxis("Analog2"); } else { if (Input.GetKey(KeyCode.UpArrow)) { pitch = 1; } if (Input.GetKey(KeyCode.DownArrow)) { pitch = -1; } if (Input.GetKey(KeyCode.LeftArrow)) { roll = -1; } if (Input.GetKey(KeyCode.RightArrow)) { roll = 1; } if (Input.GetKey(KeyCode.Q)) { pow += Time.fixedDeltaTime; } if (Input.GetKey(KeyCode.W)) { pow -= Time.fixedDeltaTime; } pow = Mathf.Clamp(pow, -1, 1); // roll=CrossPlatformInputManager.GetAxis("Horizontal"); // pitch= CrossPlatformInputManager.GetAxis("Vertical"); PlayerController.Instance().powBar.fillAmount = (pow + 1) * 0.5f; } // auto throttle up, or down if braking. // Debug.Log(GameInputController.Instance().GetDevice()); if (GameInputController.Instance().GetDevice() != null) { airBrakes = false; throttle = -GameInputController.Instance().GetAxis("Analog3"); PlayerController.Instance().powBar.fillAmount = (throttle + 1) * 0.5f; } else { airBrakes = Input.GetKey(KeyCode.LeftShift); throttle = airBrakes ? -1 : pow; } // Debug.Log(throttle); #if MOBILE_INPUT AdjustInputForMobileControls(ref roll, ref pitch, ref throttle); #endif // Pass the input to the aeroplane if (GameInputController.Instance().GetDevice() != null) { m_Aeroplane.Move(roll, pitch, yaw, (throttle + 1) * 0.5f, airBrakes); } else { m_Aeroplane.Move(roll, pitch, yaw, throttle, airBrakes); } }
// fixed update is called in time with the physics system update private void FixedUpdate() { if (m_Target != null) { // make the plane wander from the path, useful for making the AI seem more human, less robotic. Vector3 targetPos = m_Target.position + transform.right * (Mathf.PerlinNoise(Time.time * m_LateralWanderSpeed, m_RandomPerlin) * 2 - 1) * m_LateralWanderDistance; // adjust the yaw and pitch towards the target Vector3 localTarget = transform.InverseTransformPoint(targetPos); float targetAngleYaw = Mathf.Atan2(localTarget.x, localTarget.z); float targetAnglePitch = -Mathf.Atan2(localTarget.y, localTarget.z); // Set the target for the planes pitch, we check later that this has not passed the maximum threshold targetAnglePitch = Mathf.Clamp(targetAnglePitch, -m_MaxClimbAngle * Mathf.Deg2Rad, m_MaxClimbAngle * Mathf.Deg2Rad); // calculate the difference between current pitch and desired pitch float changePitch = targetAnglePitch - m_AeroplaneController.PitchAngle; // AI always applies gentle forward throttle const float throttleInput = 0.5f; // AI applies elevator control (pitch, rotation around x) to reach the target angle float pitchInput = changePitch * m_PitchSensitivity; // clamp the planes roll float desiredRoll = Mathf.Clamp(targetAngleYaw, -m_MaxRollAngle * Mathf.Deg2Rad, m_MaxRollAngle * Mathf.Deg2Rad); float yawInput = 0; float rollInput = 0; if (!m_TakenOff) { // If the planes altitude is above m_TakeoffHeight we class this as taken off if (m_AeroplaneController.Altitude > m_TakeoffHeight) { m_TakenOff = true; } } else { // now we have taken off to a safe height, we can use the rudder and ailerons to yaw and roll yawInput = targetAngleYaw; rollInput = -(m_AeroplaneController.RollAngle - desiredRoll) * m_RollSensitivity; } // adjust how fast the AI is changing the controls based on the speed. Faster speed = faster on the controls. float currentSpeedEffect = 1 + (m_AeroplaneController.ForwardSpeed * m_SpeedEffect); rollInput *= currentSpeedEffect; pitchInput *= currentSpeedEffect; yawInput *= currentSpeedEffect; // pass the current input to the plane (false = because AI never uses air brakes!) m_AeroplaneController.Move(rollInput, pitchInput, yawInput, throttleInput, false); } else { // no target set, send zeroed input to the planeW m_AeroplaneController.Move(0, 0, 0, 0, false); } }
private void FixedUpdate() { if (/*Input.GetButton("fire"))*/ inputController.bump == 1) { FireRocket(); } if ((inputController.ultrasonic) >= 16 && (inputController.ultrasonic) <= 20) { y = 0; } else if ((inputController.ultrasonic) < 16) { y = 1;// (inputController.ultrasonic-18)/5; } else if ((inputController.ultrasonic) > 20) { y = -1;// (-inputController.ultrasonic+22)/7; } // Debug.Log(y); if (inputController.gyro > -.1 && inputController.gyro < .1) { y2 = 0; } else if (inputController.gyro < -.1) { y2 = -1; } else if (inputController.gyro > .1) { y2 = 1; } Debug.Log(inputController.ultrasonic); if (inputController.pot > 2.9) { z = 0; } else if (inputController.pot < 1.9) { z = 1; } else if (inputController.pot <= 3.1 && inputController.pot >= 1.7) { z = (float)(-(inputController.pot - 3.1) * 10) / 14; } // Read input for the pitch, yaw, roll and throttle of the aeroplane. float roll = /*y2;*//* inputController.gyro;*/ CrossPlatformInputManager.GetAxis("Fire2"); float pitch = /*y;*/ CrossPlatformInputManager.GetAxis("Fire1"); m_AirBrakes = CrossPlatformInputManager.GetButton("space"); m_Yaw = /*y2 / 4;*//*(inputController.gyro)/4;*/ CrossPlatformInputManager.GetAxis("Horizontal"); m_Throttle = /*z;*/ /*script12.x;*/ CrossPlatformInputManager.GetAxis("Vertical"); #if MOBILE_INPUT AdjustInputForMobileControls(ref roll, ref pitch, ref m_Throttle); #endif // Pass the input to the aeroplane m_Aeroplane.Move(roll, pitch, m_Yaw, m_Throttle, m_AirBrakes); }
private void FixedUpdate() { m_Aeroplane.Move(0, 0, 0, 1, false); }
// fixed update is called in time with the physics system update private void FixedUpdate() { Vector3 targetPos = m_Target.position + transform.right * (Mathf.PerlinNoise(Time.time * m_LateralWanderSpeed, m_RandomPerlin) * 2 - 1) * m_LateralWanderDistance; if (stateFlee == true) { if ((transform.position - friendPos).magnitude < 500) { // make the plane wander from the path, useful for making the AI seem more human, less robotic. // adjust the yaw and pitch towards the friend Vector3 localFriend = -1 * transform.InverseTransformPoint(friendPos); float friendAngleYaw = -1 * Mathf.Atan2(localFriend.x, localFriend.z); float friendAnglePitch = Mathf.Atan2(localFriend.y, localFriend.z); // Set the friend for the planes pitch, we check later that this has not passed the maximum threshold friendAnglePitch = Mathf.Clamp(friendAnglePitch, -m_MaxClimbAngle * Mathf.Deg2Rad, m_MaxClimbAngle * Mathf.Deg2Rad); // calculate the difference between current pitch and desired pitch float changePitch = friendAnglePitch - m_AeroplaneController.PitchAngle; // AI always applies gentle forward throttle const float throttleInput = 0.5f; // AI applies elevator control (pitch, rotation around x) to reach the friend angle float pitchInput = changePitch * m_PitchSensitivity; // clamp the planes roll float desiredRoll = Mathf.Clamp(friendAngleYaw, -m_MaxRollAngle * Mathf.Deg2Rad, m_MaxRollAngle * Mathf.Deg2Rad); float yawInput = 0; float rollInput = 0; if (!m_TakenOff) { // If the planes altitude is above m_TakeoffHeight we class this as taken off if (m_AeroplaneController.Altitude > m_TakeoffHeight) { m_TakenOff = true; } } else { // now we have taken off to a safe height, we can use the rudder and ailerons to yaw and roll yawInput = friendAngleYaw; rollInput = -(m_AeroplaneController.RollAngle - desiredRoll) * m_RollSensitivity; } // adjust how fast the AI is changing the controls based on the speed. Faster speed = faster on the controls. float currentSpeedEffect = 1 + (m_AeroplaneController.ForwardSpeed * m_SpeedEffect); rollInput *= currentSpeedEffect; pitchInput *= currentSpeedEffect; yawInput *= currentSpeedEffect; // pass the current input to the plane (false = because AI never uses air brakes!) m_AeroplaneController.Move(rollInput, pitchInput, yawInput, throttleInput, false); } } if (m_Friend != null) { friendPos = m_Friend.position + transform.right * (Mathf.PerlinNoise(Time.time * m_LateralWanderSpeed, m_RandomPerlin) * 2 - 1) * m_LateralWanderDistance; } if (m_Target != null && (transform.position - targetPos).magnitude < 1000) { // make the plane wander from the path, useful for making the AI seem more human, less robotic. stateAttack = false; stateFlee = false; stateFollow = true; stateProtect = false; if ((transform.position - targetPos).magnitude < 350) { stateAttack = true; stateFlee = false; stateFollow = false; stateProtect = false; //AI BISA NEMBAK Collider[] shipColliders = transform.GetComponentsInChildren <Collider>(); nextFire -= Time.deltaTime; if (nextFire <= 0) { for (int i = 0; i < 1; i++) { GameObject bulletClone = Instantiate(bullet, firePoints[i].position, transform.rotation); for (int j = 0; j < shipColliders.Length; j++) { Physics.IgnoreCollision(bulletClone.transform.GetComponent <Collider>(), shipColliders[j]); } } nextFire = 1 / fireRate; } } // adjust the yaw and pitch towards the target Vector3 localTarget = transform.InverseTransformPoint(targetPos); float targetAngleYaw = Mathf.Atan2(localTarget.x, localTarget.z); float targetAnglePitch = -Mathf.Atan2(localTarget.y, localTarget.z); // Set the target for the planes pitch, we check later that this has not passed the maximum threshold targetAnglePitch = Mathf.Clamp(targetAnglePitch, -m_MaxClimbAngle * Mathf.Deg2Rad, m_MaxClimbAngle * Mathf.Deg2Rad); // calculate the difference between current pitch and desired pitch float changePitch = targetAnglePitch - m_AeroplaneController.PitchAngle; // AI always applies gentle forward throttle const float throttleInput = 0.5f; // AI applies elevator control (pitch, rotation around x) to reach the target angle float pitchInput = changePitch * m_PitchSensitivity; // clamp the planes roll float desiredRoll = Mathf.Clamp(targetAngleYaw, -m_MaxRollAngle * Mathf.Deg2Rad, m_MaxRollAngle * Mathf.Deg2Rad); float yawInput = 0; float rollInput = 0; if (!m_TakenOff) { // If the planes altitude is above m_TakeoffHeight we class this as taken off if (m_AeroplaneController.Altitude > m_TakeoffHeight) { m_TakenOff = true; } } else { // now we have taken off to a safe height, we can use the rudder and ailerons to yaw and roll yawInput = targetAngleYaw; rollInput = -(m_AeroplaneController.RollAngle - desiredRoll) * m_RollSensitivity; } // adjust how fast the AI is changing the controls based on the speed. Faster speed = faster on the controls. float currentSpeedEffect = 1 + (m_AeroplaneController.ForwardSpeed * m_SpeedEffect); rollInput *= currentSpeedEffect; pitchInput *= currentSpeedEffect; yawInput *= currentSpeedEffect; // pass the current input to the plane (false = because AI never uses air brakes!) m_AeroplaneController.Move(rollInput, pitchInput, yawInput, throttleInput, false); } if (m_Friend != null) { if ((transform.position - friendPos).magnitude < 500) { stateAttack = false; stateFlee = false; stateFollow = false; stateProtect = true; // make the plane wander from the path, useful for making the AI seem more human, less robotic. // adjust the yaw and pitch towards the friend Vector3 localFriend = transform.InverseTransformPoint(friendPos); float friendAngleYaw = Mathf.Atan2(localFriend.x, localFriend.z); float friendAnglePitch = -Mathf.Atan2(localFriend.y, localFriend.z); // Set the friend for the planes pitch, we check later that this has not passed the maximum threshold friendAnglePitch = Mathf.Clamp(friendAnglePitch, -m_MaxClimbAngle * Mathf.Deg2Rad, m_MaxClimbAngle * Mathf.Deg2Rad); // calculate the difference between current pitch and desired pitch float changePitch = friendAnglePitch - m_AeroplaneController.PitchAngle; // AI always applies gentle forward throttle const float throttleInput = 0.5f; // AI applies elevator control (pitch, rotation around x) to reach the friend angle float pitchInput = changePitch * m_PitchSensitivity; // clamp the planes roll float desiredRoll = Mathf.Clamp(friendAngleYaw, -m_MaxRollAngle * Mathf.Deg2Rad, m_MaxRollAngle * Mathf.Deg2Rad); float yawInput = 0; float rollInput = 0; if (!m_TakenOff) { // If the planes altitude is above m_TakeoffHeight we class this as taken off if (m_AeroplaneController.Altitude > m_TakeoffHeight) { m_TakenOff = true; } } else { // now we have taken off to a safe height, we can use the rudder and ailerons to yaw and roll yawInput = friendAngleYaw; rollInput = -(m_AeroplaneController.RollAngle - desiredRoll) * m_RollSensitivity; } // adjust how fast the AI is changing the controls based on the speed. Faster speed = faster on the controls. float currentSpeedEffect = 1 + (m_AeroplaneController.ForwardSpeed * m_SpeedEffect); rollInput *= currentSpeedEffect; pitchInput *= currentSpeedEffect; yawInput *= currentSpeedEffect; // pass the current input to the plane (false = because AI never uses air brakes!) m_AeroplaneController.Move(rollInput, pitchInput, yawInput, throttleInput, false); } } else { // no friend set, send zeroed input to the planeW m_AeroplaneController.Move(0, 0, 0, 0, false); } }