- Home /
Input Axis is Not Setup
Hello. I am working on a flight simulator. I watched a tutorial on making air flight and downloaded an asset used in the video given by the creator. In one of the scripts, it is looking for an axis called, "Yaw." But when trying to run the game I get an error saying Input Axis "Yaw" is not set up. This is thescript, is something wrong? using System.Collections; using System.Collections.Generic; using UnityEditorInternal; using UnityEngine; using UnityEngine.SceneManagement;
public class AirplaneController : MonoBehaviour
{
[SerializeField]
float rollControlSensitivity = 0.2f;
[SerializeField]
float pitchControlSensitivity = 0.2f;
[SerializeField]
float yawControlSensitivity = 0.2f;
[SerializeField]
float thrustControlSensitivity = 0.01f;
[SerializeField]
float flapControlSensitivity = 0.15f;
float pitch;
float yaw;
float roll;
float flap;
float thrustPercent;
bool brake = false;
AircraftPhysics aircraftPhysics;
Rotator propeller;
private void Start()
{
aircraftPhysics = GetComponent<AircraftPhysics>();
propeller = FindObjectOfType<Rotator>();
SetThrust(0);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.R))
{
SceneManager.LoadScene(0);
}
if (Input.GetKey(KeyCode.Space))
{
SetThrust(thrustPercent + thrustControlSensitivity);
}
propeller.speed = thrustPercent * 1500f;
if (Input.GetKeyDown(KeyCode.LeftShift))
{
thrustControlSensitivity *= -1;
flapControlSensitivity *= -1;
}
if (Input.GetKeyDown(KeyCode.B))
{
brake = !brake;
}
if (Input.GetKeyDown(KeyCode.LeftControl))
{
flap += flapControlSensitivity;
//clamp
flap = Mathf.Clamp(flap, 0f, Mathf.Deg2Rad * 40);
}
pitch = pitchControlSensitivity * Input.GetAxis("Vertical");
roll = rollControlSensitivity * Input.GetAxis("Horizontal");
yaw = yawControlSensitivity * Input.GetAxis("Yaw");
}
private void SetThrust(float percent)
{
thrustPercent = Mathf.Clamp01(percent);
}
private void FixedUpdate()
{
aircraftPhysics.SetControlSurfecesAngles(pitch, roll, yaw, flap);
aircraftPhysics.SetThrustPercent(thrustPercent);
aircraftPhysics.Brake(brake);
}
}
Answer by FlaSh-G · Sep 25, 2021 at 10:15 PM
"Yaw" is not one of Unity's default input axes, you need to set it up.
Your answer
Follow this Question
Related Questions
change character movement axis in respect to camera orientation? 1 Answer
How Do I Snap Input Between 1, 0, and -1 0 Answers
Force input on Button? 1 Answer
how to use the axises on the xbox one controller? 0 Answers
Input returns 0 until released and pressed again if held down before start of scene 0 Answers