Hello. I am having difficulty as to why my spherecastmulti from KismetSystemLibrary only detects one actor at a time. here is my code for the sphere tracing. At first it was working as usual but the next day I open my project it started to behave this way.
const FVector CameraDirection = FRotationMatrix(Character->GetControlRotation()).GetUnitAxis(EAxis::X);
const FVector StartLocation = CharacterMesh->GetSocketLocation(TraceSocket);
const FVector EndLocation = StartLocation + (CameraDirection * TraceLength);
TArray<AActor*> ActorsToIgnore;
ActorsToIgnore.Add(GetOwner());
TArray<FHitResult> OutHits;
if (!UKismetSystemLibrary::SphereTraceMulti(
GetWorld(),
StartLocation,
EndLocation,
TraceRadius,
TraceTypeQuery,
false,
ActorsToIgnore,
DrawDebugType,
OutHits,
true
))
return;
GEngine->AddOnScreenDebugMessage(-1, 0.0, FColor::Red, FString::FromInt(OutHits.Num()));
I’ve printed the number of element of the outhits. I duplicated 1 object and aligned them perfectly.