Crouching height and smooth crouching

I’ve been messing around with UE4 and decided to make a first person character crouch. Ok, no problem, it crouches alright, but when I tried to make crouching smoother (so the camera won’t just “snap” to it’s new position), I could not find a “good” way.

Currently, what I’m doing is (inside the character Tick)

if (CharacterMovement->bWantsToCrouch)
{
	if (CharacterMovement->CrouchedHalfHeight > FinalCrouchingHeight)
	{
		CharacterMovement->CrouchedHalfHeight -= 2;
		CharacterMovement->Crouch();
	}
}

That works, but it just doesn’t feel right having to call Crouch() every time (maybe it is?)

I tried not calling it, but then the first person view won’t adjust itself because AdjustProxyCapsuleSize() is not called (at least that’s what must be called if I understood it correctly) - and I can’t call it directly since it’s protected.

So what would be the “good” way to do this smooth crouching? And also, how can I change the height of the character when crouching to something below 42? I played with CrouchedHalfHeight from CharacterMovementComponent and SetCapsuleHalfHeight from CapsuleComponent, but that only goes as low as “42” (it doesn’t matter if I set it to something like 20 or 10).

ps: I’m also pretty new do C++, so if my mistake is somehow linked to the language itself, I apologize

I just made a related post on the forums which shows what you need to create your own crouch implementation.
Since UE3 I’ve stayed away from the default crouch implementation.

Link

Thanks for the link!

So basically I should steer away from the default crouching huh

Well, that’s too bad… it would be much easier if I could use what’s already there

Well, I just found it easier to implement it myself from scratch rather than fighting against existing code. In the end it’s up to you to decide.