My plane is not working

I’m creating an airplane simulator game, and I’m starting to program a simple airplane, but I’ve already written the code but it’s not flying and I don’t understand why, can you help me?

private float throttle;
private float roll;
private float pitch;
private float yaw;

private float responseModifier
{
    get
    {
        return (rb.mass / 10f) * responsiveness;
    }
}

Rigidbody rb;

void Awake()
{
    rb = GetComponent<Rigidbody>();
}

void handleInputs()
{
    roll = Input.GetAxis("Roll");
    pitch = Input.GetAxis("Pitch");
    yaw = Input.GetAxis("Yaw");

    if (Input.GetKey(KeyCode.Space)) throttle += throttleIncrement;
    else if (Input.GetKey(KeyCode.LeftControl)) throttle -= throttleIncrement;
    throttle = Mathf.Clamp(throttle, 0f, 100f);
}

void Update()   
{
    handleInputs();
}

void update()
{
    rb.AddForce(transform.forward * maxThrust * throttle);
    rb.AddTorque(transform.up * yaw * responseModifier);
    rb.AddTorque(transform.right * pitch * responseModifier);
    rb.AddTorque(transform.forward * roll * responseModifier);
}

There are open source repos of a basic flight controls. You should consider downloading these projects and looking into how it’s all coded there. Good learning material.

I don’t know if some of the code is missing, but some of your variables are not defined, also you are calling your updates inside update instead of Update(capital U), so you’re just creating a new void called "update" instead of using the actual Update.

I fixed those issues and I used FixedUpdate instead of Update (FixedUpdate is better to use for physics updates), and now the plane script works as intended.

Modified code:

private float throttle;
private float roll;
private float pitch;
private float yaw;
[SerializeField]
private float responsiveness = 1f;
[SerializeField]
private float throttleIncrement = 0.01f;
[SerializeField]
private float maxThrust = 2f;

private float responseModifier
{
    get
    {
        return (rb.mass / 10f) * responsiveness;
    }
}

Rigidbody rb;

void Awake()
{
    rb = GetComponent<Rigidbody>();
}

void handleInputs()
{
    roll = Input.GetAxis("Roll");
    pitch = Input.GetAxis("Pitch");
    yaw = Input.GetAxis("Yaw");
    if (Input.GetKey(KeyCode.Space)) throttle += throttleIncrement;
    else if (Input.GetKey(KeyCode.LeftControl)) throttle -= throttleIncrement;
    throttle = Mathf.Clamp(throttle, 0f, 100f);
}

void FixedUpdate()
{
    handleInputs();
    rb.AddForce(transform.forward * maxThrust * throttle);
    rb.AddTorque(transform.up * yaw * responseModifier);
    rb.AddTorque(transform.right * pitch * responseModifier);
    rb.AddTorque(transform.forward * roll * responseModifier);
}

(thanks andrew-lukasik for neatening my answer)