CharacterController won't stay grounded

I know this is a many times asked question, but I have not found any answers but trying other posts answers. I cannot get my character to not stop flickering the grounded bool on and off. IF I use a normal capsule, everything is fine and it stays but for some reason my model won’t. I’m not sure if it’s something with the animations or something else.

Here is movement code:

   groundedPlayer = controller.isGrounded;
            if (groundedPlayer && playerVelocity.y < 0)
            {
                playerVelocity.y = 0f;
            }
    
            runAction.performed += _ => runHoldDown = true;
            runAction.canceled += _ => runHoldDown = false;
    
            crouchAction.performed += _ => crouchHoldDown = true;
            crouchAction.canceled += _ => crouchHoldDown = false;
    
            //Lock run and crouch depending on current action
            if (CanRun)
            {
                if (runHoldDown)
                {
                    if (attackAction.triggered)
                    {
                        startAttack();
                    }
                    else
                    {
                        animator.SetBool("Running", true);
                        playerSpeed = runSpeed;
                        CanCrouch = false;
                    }
                    
                }
                else if (!runHoldDown)
                {
                    if (attackAction.triggered)
                    {
                        startAttack();
                    }
                    else
                    {
                        animator.SetBool("Running", false);
                        playerSpeed = walkSpeed;
                        CanCrouch = true;
                    }
                }
            }
            if (CanCrouch)
            {
                if (crouchHoldDown)
                {
                    if (attackAction.triggered)
                    {
                        startAttack();
                    }
                    else
                    {
                        playerSpeed = crouchSpeed;
                        animator.SetBool("Crouching", true);
                        CanRun = false;
                    }
                }
                else if (!crouchHoldDown)
                {
                    if (attackAction.triggered)
                    {
                        startAttack();
                    }
                    else
                    {
                        animator.SetBool("Crouching", false);
                        playerSpeed = walkSpeed;
                        CanRun = true;
                    }
                }
            }
            
    
            Vector2 input = moveAction.ReadValue<Vector2>();
            currentAnimationBlendVector = Vector2.SmoothDamp(currentAnimationBlendVector, input, ref animationVelocity, animationSmoothTime);
            Vector3 _lastInput = input;
            Vector3 move = new Vector3(currentAnimationBlendVector.x, 0, currentAnimationBlendVector.y);
            move = move.x * cameraTransform.right.normalized + move.z * cameraTransform.forward.normalized;
            move.y = 0f;
    
            controller.Move(playerSpeed * Time.deltaTime * move);
            animator.SetFloat(speedXAnimationParameterID, currentAnimationBlendVector.x);
            animator.SetFloat(speedYAnimationParameterID, currentAnimationBlendVector.y);
    
    
            // Changes the height position of the player (jump)
            if (jumpAction.triggered && groundedPlayer)
            {
                playerVelocity.y += Mathf.Sqrt(jumpHeight * -3.0f * gravityValue);
                if (!runHoldDown)
                {
                    animator.Play(jumpAnimation);
                }
                else
                {
                    animator.Play("Running Jump");
                }
                
            }
    
            //Jump Control
            playerVelocity.y += gravityValue * Time.deltaTime;
            controller.Move(playerVelocity * Time.deltaTime);
    
            // Rotate towards camera direction when moving
            if (_lastInput.sqrMagnitude == 0) return;
            float targetAngle = cameraTransform.eulerAngles.y;
            Quaternion targetRotation = Quaternion.Euler(0, targetAngle, 0);
            transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);

This was made following Samyam’s guide and I am using terrain with my character controller. The controllers collider is at the characters ankle height which also shouldn’t cause issues, but the character also isn’t inside the ground in anyway, despite having no other colliders.

This issue makes it really hard to have a smooth controller as you need to spam jump to be able to do it.

Watch the main parent object, during play and see if the Y position is jumping around. I have not seen any animations move the parent, as animations are purely visual. If the Y itself is jumping around, it might be because of using FixedUpdate and Update, not sure if you’re using both? But Update runs once every frame, and FixedUpdate can run twice in a frame, or even not at all within a frame. So without proper counters, the code can get confused. So while moving on un-even ground, it could prove to be choppy. One simple(not-so-simple) fix is to hard code the Y value, while raycasting world-down checking average height(maybe even a little extra dead-zone). But when logic fails? Debug ;)