Why is player pushed up?

Hello all,

I am on implementing a character controller, having a state machine and a problem. When walking while crouching, already in the first frame for whatever reason, the character controller of my player is pushed up which causes the player not being grounded anymore. It happens after the controller.Move.

I took into consideration the skin width, but that’s not the problem.

public class CrouchWalkState : ProcanimState
{
    public override void OnEnable()
    {
        data.isCrouching = true;
    }

    public override void Update()
    {
        float x = Input.GetKey(KeyCode.D) ? 1 : (Input.GetKey(KeyCode.A) ? -1 : 0);
        float z = Input.GetKey(KeyCode.W) ? 1 : (Input.GetKey(KeyCode.S) ? -1 : 0);

        // Calculating the horizontal direction, in which the player is moving.
        data.horizontalDirection = data.transform.right * x + data.transform.forward * z;
        data.speed = 0.75f;

        // Calculating the speed, with which the player is moving.
        Vector3 movementSpeed = data.horizontalDirection.normalized * data.speed;

        // Important for ramp walking, else the player is stuttering
        if (data.isGrounded && data.controller.velocity.y < 0.001f)
        {
            data.verticalVelocity = -5f;
        }
        else
        {
            data.verticalVelocity -= data.gravity * Time.deltaTime;
        }

        movementSpeed.y = data.verticalVelocity;
        float posY1 = data.controller.transform.position.y; // debug

        data.controller.Move(movementSpeed * Time.deltaTime);

        float posY2 = data.controller.transform.position.y; // debug

        if(data.controller.transform.position.y > 0.035f) // debug
        {
            // Breakpoint is here
        }
    }
}

This is what the debugger shows:
2023_12_17_15_30_54_ProceduralAnimationScene_Debugging_Microsoft_Visual_Studio

Anybody some ideas, why the controller is pushed up?

Thank you
Huxi

I finally found the root cause, I got the idea for it by reading the nvidia CCT SDK description: Character Controllers — NVIDIA PhysX SDK 3.4.0 Documentation

So when the player is crouching down, I was adjusting the character controller center and height. At the end of the crouching the controller was a little tiny bit above the skin width, so that it never reached the ground and was constantly in the falling animation. So I have moved the controller a little bit up and now it works. :).