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"));
}
}
}