How can I un-invert my first person spaceship controls in C#?

Hi, I’m trying to make a first person spaceship shooter game. I am currently working on the movement script and so far it has been going well, however I have it so that you can turn using Q and E. When this happens though it changes make controls and rotates the ships forward based on the global X-Y-Z axis rather than relative to it. Here is a sample of my code:

public float forwardSpeed = 75f;
public float lookSpeed = 75f;
public float twistSpeed = 75f;

private float pitch = 0;
private float yaw = 0;
private float twist = 0;
private GameObject referencePoint;

private void Start()
{
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = false;
    referencePoint = GameObject.Find("ReferencePoint");
}

void FixedUpdate ()
{
    if (Input.GetKey(KeyCode.Q))
    {
        twist += twistSpeed * Time.fixedDeltaTime;
    }

    if (Input.GetKey(KeyCode.E))
    {
        twist -= twistSpeed * Time.fixedDeltaTime;
    }

    pitch -= Input.GetAxis("Mouse Y") * lookSpeed * Time.fixedDeltaTime;

    yaw += Input.GetAxis("Mouse X") * lookSpeed * Time.fixedDeltaTime;

    transform.eulerAngles = new Vector3(pitch, yaw, twist);

    transform.position += transform.forward * forwardSpeed * Time.fixedDeltaTime;
}

I’ve been working on this for a while now and haven’t been able to get it to work. I’m still pretty new to C# and Unity in general. Thanks in advance for any help I might get :),

@nussbau65 I don’t know, instead of transform.eulerAngles have you tried transform.Rotate instead ? If you don’t specify, the rotation should be around Space.Self instead of Space.World, which, if I am understanding your question, that is what’s happening right?