ProjectBorealis / PBCharacterMovement

HL2-style, classic FPS movement for Unreal Engine implemented in C++

Home Page:https://www.projectborealis.com/movement

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

commented

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;
commented

Fixed in 74791cb