Closed Hevedy closed 2 years ago
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;
Fixed in 74791cb2b465c5b1e0b3bd9beb91ac1d6accf570
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