x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

GetOverlappingActors

I have actor Sphere that spawns a sphere and I have an Actor SpawnVolume that is a BoxComponent that on BeginPlay() spawns the Sphere randomly within the BoxComponent. I know how to check for overlapping actors within blueprint, but can't seem to figure it out in c++. I want every tick to check the randomly created sphere for any characters that are either inside or outside this sphere.

Product Version: UE 4.10
Tags:
more ▼

asked Feb 02 '16 at 04:18 AM in C++ Programming

avatar image

hostagex
1 1 3 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Thanks for the response!

I was able to figure this part out. And I think I am checking to see if it is the client's character who overlapped with the sphere. But ultimately what I want is a class that only ticks on the server, checks for overlapping characters only, and if it finds one it displays to only that clients screen it was overlapping. This is what I have so far: I can run

 if (HasAuthority())
     {
         AIrisCharacter* MyCharacter = Cast<AIrisCharacter>(UGameplayStatics::GetPlayerPawn(this, 0));
         
         TArray<AActor*> Sphere;
         BaseCollisionComponent->GetOverlappingActors(Sphere);
     
         for (int32 b = 0; b < Sphere.Num(); b++)
         {
             AActor* const testCharacter = Sphere[b];
             if (MyCharacter && testCharacter->IsOverlappingActor(MyCharacter)) {
             }
         }
 }

I guess the issue I have is I need to get a list of all available characters, and loop through that as well against the array of collisions? I'm not sure if there is a better way to check that isn't that taxing?

more ▼

answered Feb 02 '16 at 12:58 PM

avatar image

hostagex
1 1 3 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question