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