Camera on uncrouch get too adjusted to capsule end
Hevedy opened this issue · comments
When uncrouch the camera get too close to the end of the capsule, as result on collisions the camera ends inside meshes or on middle point.
A parameter to limit the distance between capsule half size and % between end could be a good point
This is in our internal code, but hasn't been pushed yet. We're currently heads down working on content, so we can't commit time to updating the open source version at this time.
void APBPlayerCharacter::RecalculateBaseEyeHeight()
{
BaseEyeHeight = FMath::Lerp(GetDefault<APawn>(GetClass())->BaseEyeHeight, CrouchedEyeHeight, MovementPtr->CrouchAlpha);
}
In the DoCrouchResize
:
CrouchAlpha = TargetAlpha;
OwnerRef->OnEndCrouch(HalfHeightAdjust, ScaledHalfHeightAdjust); <- above this method call
In the DoUnCrouchResize
:
CrouchAlpha = 1.0f - TargetAlpha;
OwnerRef->OnStartCrouch(HalfHeightAdjust, ScaledHalfHeightAdjust); <- above this method call
On both Crouch methods where it's returning and setting bInCrouch = false
also add:
CrouchAlpha = 0;