How can I get my Trace function to work?

Hey! I am trying to create a trace function on collision, that checks if the player is facing the object that he has just collided with. The function traces, but never recognizes the if statement as true. Anyone know what is going wrong?

    //Get Collision Info
    void AFPSCharacter::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
    {
    	wJumpTrace(OtherActor);
    	GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Red, TEXT("Sent to Trace"));
    }
    
    void AFPSCharacter::wTrace(AActor* Wall)
    {
    	UWorld* TheWorld = this->GetWorld();
    	const FVector Start = GetActorLocation();
    	const FVector& End = CapsuleComponent->GetForwardVector() * wScanDist;
    	FHitResult HitOut;
    	FCollisionQueryParams TraceParams(TEXT("Wall Trace"));
    	//Trace to make sure player is facing wall
    	if (TheWorld->LineTraceSingle(HitOut, Start, End, ECC_WorldStatic, TraceParams))
    	{
    		GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Red, TEXT("Tracing..."));
    		if (HitOut.GetActor() == Wall)
    		{
    			GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Red, TEXT("Is facing wal"));
    		}
    	}
    }

#Ignore The Tracing Actor

You’re probably tracing the actor every time, who is sending out the trace!

#AddIgnoredActor

FCollisionQueryParams TraceParams(TEXT("Wall Trace"));

//Make sure to ignore sender of trace!
TraceParams.AddIgnoredActor(this);

#:heart:

Rama

Thanks, this solved the problem. I was just wondering if you could help me find another error in that piece of code? The tracer seems to be able to find a target no matter where I jump from (like the distance is infinite), which I dont understand (I have tried decreasing “scanDistance” to ridiculous amounts). Also, sometimes, it doesnt seem to find that the collided actor is the same as the one detected by the ray. Do you know what the problem might be? I would be really thankful if you could help me out on this one! Cheers (if not, I will just mark as correct anyway. Just give me some feedback).

Okay, so I found it out myself. I had to change the end vector:

const FVector& End = Start + CapsuleComponent->GetForwardVector() * wScanDist;