Skip to content
Snippets Groups Projects
Commit a18bc5db authored by David Gilbert's avatar David Gilbert :bug:
Browse files

fix(Navigation): Dirty fix for Trigger volumes blocking movement. Needs to be revisited.

parent b2e1e364
No related branches found
No related tags found
2 merge requests!80UE5.3-2023.1-rc2,!77ContentExample-themed ToolkitExamples map.
Pipeline #372550 passed
...@@ -342,19 +342,14 @@ TOptional<FVector> UCollisionHandlingMovement::GetOverlapResolveDirection() cons ...@@ -342,19 +342,14 @@ TOptional<FVector> UCollisionHandlingMovement::GetOverlapResolveDirection() cons
{ {
TArray<UPrimitiveComponent*> OverlappingComponents; TArray<UPrimitiveComponent*> OverlappingComponents;
TArray<TEnumAsByte<EObjectTypeQuery>> traceObjectTypes; TArray<TEnumAsByte<EObjectTypeQuery>> traceObjectTypes;
traceObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_Visibility)); traceObjectTypes.Add(EObjectTypeQuery::ObjectTypeQuery_MAX);
UKismetSystemLibrary::CapsuleOverlapComponents(GetWorld(), CapsuleColliderComponent->GetComponentLocation(), UKismetSystemLibrary::CapsuleOverlapComponents(GetWorld(), CapsuleColliderComponent->GetComponentLocation(),
CapsuleColliderComponent->GetScaledCapsuleRadius(), CapsuleColliderComponent->GetScaledCapsuleRadius(),
CapsuleColliderComponent->GetScaledCapsuleHalfHeight(), CapsuleColliderComponent->GetScaledCapsuleHalfHeight(),
traceObjectTypes, nullptr, ActorsToIgnore, OverlappingComponents); traceObjectTypes, nullptr, ActorsToIgnore, OverlappingComponents);
if (OverlappingComponents.Num() == 0) TOptional<FVector> ResolveVector;
{
// return unset optional
return TOptional<FVector>();
}
FVector ResolveVector = FVector::ZeroVector;
// check what to do to move out of these collisions (or nothing if none is there) // check what to do to move out of these collisions (or nothing if none is there)
// we just add the penetrations so in very unfortunate conditions this can become problematic/blocking but for now // we just add the penetrations so in very unfortunate conditions this can become problematic/blocking but for now
// and our regular use cases this works // and our regular use cases this works
...@@ -362,7 +357,13 @@ TOptional<FVector> UCollisionHandlingMovement::GetOverlapResolveDirection() cons ...@@ -362,7 +357,13 @@ TOptional<FVector> UCollisionHandlingMovement::GetOverlapResolveDirection() cons
{ {
FHitResult Hit = CreateCapsuleTrace(CapsuleColliderComponent->GetComponentLocation(), FHitResult Hit = CreateCapsuleTrace(CapsuleColliderComponent->GetComponentLocation(),
OverlappingComp->GetComponentLocation(), false); OverlappingComp->GetComponentLocation(), false);
ResolveVector += Hit.ImpactNormal * Hit.PenetrationDepth;
if (Hit.bBlockingHit)
{
FVector Change = Hit.ImpactNormal * Hit.PenetrationDepth;
ResolveVector = ResolveVector.IsSet() ? ResolveVector.GetValue() + Change : Change;
} }
}
return ResolveVector; return ResolveVector;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment