1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| void UGolbalFunc ::TestFilter( AMyChar* _actor , float _radius) { TArray<AActor *> ignoreChars; TArray<TEnumAsByte <EObjectTypeQuery>> destObjectTypes; destObjectTypes.Add ((EObjectTypeQuery) ECollisionChannel::ECC_Pawn ); TArray<AActor *> destActors; UKismetSystemLibrary::SphereOverlapActors_NEW ( GWorld , _actor->GetActorLocation () , _radius , destObjectTypes , AMyChar::StaticClass () , ignoreChars, destActors );
UE_LOG(GolbalFuncLogger, Warning , TEXT("--- destActors length:%d"), destActors.Num ()); for (auto elem : destActors) { AMyChar* mychar = Cast< AMyChar>(elem ); if (mychar ) { UE_LOG(GolbalFuncLogger, Warning , TEXT("--- mychar uuid:%d"), mychar->GetUuid ()); :: DrawDebugLine(GWorld , _actor-> GetActorLocation(), mychar->GetActorLocation (), FColor:: Red, true , 5.f); } } }
|