Ok nevermind, my code didn’t compile.
I’ve tried what you said and got a syntax error:
if (GetWorld()->LineTraceSingleByChannel(*HitResult,StartTrace,EndTrace,ECC_Visibility,*TraceParams))
{
DrawDebugLine(GetWorld(), StartTrace, EndTrace, FColor(255, 0, 0),true);
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, FString::Printf(TEXT("You hit: %s"),*HitResult->Actor->GetName()));
if (HitResult->Actor->GetName() == "Door1")
{
ADoorTrigger *HitDoorTrigger = Cast<ADoorTrigger>(HitResult->Actor);
if (HitDoorTrigger) {
SetActorLocation(HitDoorTrigger->Destination->GetComponentLocation());
}
}
}
error: no instance of overloaded function “Cast” matches the argument list