Description

CharacterMovementComponent has recently received support for custom gravity directions. Crouch logic needs to be updated to account for custom directions. Currently, crouching logic in CMC assumes Z-up, such as in encroach checks:

const bool bEncroached = GetWorld()->OverlapBlockingTestByChannel(UpdatedComponent->GetComponentLocation() - FVector(0.f,0.f,ScaledHalfHeightAdjust), FQuat::Identity,
    UpdatedComponent->GetCollisionObjectType(), GetPawnCapsuleCollisionShape(SHRINK_None), CapsuleParams, ResponseParam); 

and when snapping the component to its walkable base:

UpdatedComponent->MoveComponent(FVector(0.f, 0.f, -ScaledHalfHeightAdjust), UpdatedComponent->GetComponentQuat(), true, nullptr, EMoveComponentFlags::MOVECOMP_NoFlags, ETeleportType::TeleportPhysics); 
Steps to Reproduce

When using non-default character gravity, observe that characters crouch and uncrouch without moving relative to their base. Observe that characters can crouch under obstructions and fail to uncrouch when they don't have clearance.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-207486 in the post.

0
Login to Vote

Fixed
ComponentUE - Gameplay - Components
Affects Versions5.3
Target Fix5.5
Fix Commit32179936
Main Commit32179936
CreatedFeb 20, 2024
ResolvedMar 12, 2024
UpdatedJul 22, 2024
View Jira Issue