We already know how to detect collision and filter it. But now we have to detect side of collision, because we should know what side we use now and what behavior should be next. For example, if we hit it with front, we could not enable wall run.
Let’s start to develop, the first thing it will be an enum, we have to check which side was hit.
UENUM() enum EWallSide { None, Left, Right };
And change our OnCapsuleHit method on
void AWallRunCharacter::OnCapsuleHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) { const FVector HitNormal = Hit.ImpactNormal; if(HitNormal.Z > GetCharacterMovement()->GetWalkableFloorZ() || HitNormal.Z < -0.01f) { return; } EWallSide Side = EWallSide::None; if(FVector::DotProduct(HitNormal, GetActorRightVector()) > 0) { Side = EWallSide::Left; GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Blue, TEXT("Capsule has been hit, with side:Left" )); } else { Side = EWallSide::Right; GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Blue, TEXT("Capsule has been hit, with side: Right" )); } }
Recompile and run.

Thats exactly what we expected.
If you have any questions, join Discord.
Cheers!