How do I prevent my fps player from flying?

I was wondering if anyone knew how I can get my fps Character Controller to not be able to fly when I look up and hold “W”.
This is my code for moving :

        move = new Vector3(Input.GetAxis(Axis.HORIZONTAL), 0f, Input.GetAxis(Axis.VERTICAL));
        move = transform.TransformDirection(move);
        move *= floSpeed * Time.deltaTime;
        characterController.Move(move);

This is my code for looking around:

            yaw += SpeedH * Input.GetAxis("Mouse X");
            pitch -= SpeedV * Input.GetAxis("Mouse Y");
            transform.eulerAngles = new Vector3(pitch, yaw, 0.0f);

If my comment is accurate with your question, then you can fix it by offsetting the “Center’s Y-value (0, 0, 0) to (0, “Skin Width”, 0)”. Skin Width being another vaariable in the component. I only just tried this out, so for more information this is the documentation: Unity - Manual: Character Controller component reference


My best guess is that the skin width variable offers a gap between the model and collider to prevent your character from getting stuck in certain situations where maybe ground is uneven. So by raising the center, it will compensate by lowering your model to the floor while keeping the capsule collision higher.