Better Surface Orientation
Surface collision inside geometry


More visually accurate collision

Extra Sweep per collision


Last updated





Last updated
// ZCCharacterMovementComponent.cpp
void UZCCharacterMovementComponent::ComputeSurfaceInfo()
{
// ...
const FVector Start = UpdatedComponent->GetComponentLocation();
const FCollisionShape CollisionShape = FCollisionShape::MakeSphere(6); //reasonably smol sphere
for (const FHitResult& WallHit : CurrentWallHits)
{
const FVector End = Start + (WallHit.ImpactPoint - Start).GetSafeNormal() * 120; //magic number here is just making sure we make it to the surface
FHitResult AssistHit;
GetWorld()->SweepSingleByChannel(AssistHit, Start, End, FQuat::Identity, ECC_WorldStatic, CollisionShape, ClimbQueryParams);
CurrentClimbingPosition += AssistHit.ImpactPoint;
CurrentClimbingNormal += AssistHit.Normal;
}
// ...
}