Hi there,
I’m trying to convert some basic blueprint code into C++, but there’s one little thing I can’t figure out.
Here’s the BP section:
and here’s my current code:
void AMainCharacter::Tick(float DeltaTime){
Super::Tick(DeltaTime);
ACustomPlayerController* Controller = (ACustomPlayerController*)GetWorld()->GetFirstPlayerController();
FVector CameraLocation = Controller->PlayerCameraManager->GetCameraLocation();
FVector CameraEndLocation = (Controller->PlayerCameraManager->GetActorForwardVector() * InteractDistance) + CameraLocation;
TArray<FHitResult> Hit;
FCollisionQueryParams TraceParams = FCollisionQueryParams(FName(TEXT("Trace")), true, this);
TraceParams.bTraceAsyncScene = true;
bool bHasHit = GetWorld()->LineTraceMulti(Hit, CameraLocation, CameraEndLocation, ECC_WorldDynamic, TraceParams);
DrawDebugLine(GetWorld(), CameraLocation, CameraEndLocation, FColor(255, 0, 0), false, -1, 0, 12.333);
if (bHasHit)
{
GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, "Tracing works");
}
}
The main problem I’m having is getting the node “Make Array: World Dynamic, World Static”.
I thought you could do ECC_WorldDynamic && ECC_WorldStatic, but that doesn’t seem to work.
Is there a solution to this? Thanks in advance for the answer.