UE4 Character collider goes through floor when crouching

Hello,

I’m using the 3rd person blueprint template and I’ve added a custom sprint and custom crouch functionality to it…
when crouching I trigger the crouching animations according to the character speed and set the max walk speed to a low value, I can interrupt the crouch by sprinting and vice versa… I can stand up from the crouch by pressing the crouch key again or attempting to jump.

It all worked quite well, until I attempted to manipulate the capsule collider’s half height according to the character’s speed whenever crouch, jump, or sprint is pressed…
I can see the collider working as expected, however when I try to crouch the character’s feet sink into the ground and when I try to stand up again the character falls through the floor…

Any help would be greatly appreciated…