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"

My Trigger Box Detects All of My Characters When Overlapped? C++

I have created a trigger box that simply detects overlapped actors. The project I am working on is a LAN project so when I spawn in two characters from the same class(I feel like this is something close to the issue), if one of the characters overlaps the trigger box, the trigger box announces that BOTH characters overlapped.

I have no idea why this is happening. The error occurs no matter how many characters there are so when I tested with three players, when one hit the trigger, it registered as if all of them did.

Please help! Any and all responses are appreciated and thank you again for taking the time to read this.

Product Version: UE 4.19
Tags:
more ▼

asked Jul 22 '18 at 10:50 PM in C++ Programming

avatar image

Chibey
2 1 3 5

avatar image mightyenigma Jul 23 '18 at 04:32 AM

how are you triggering and receiving the overlap event? And in which class(es)?

avatar image Chibey Jul 23 '18 at 08:41 PM

Hey! Thanks for replying. I am triggering using a standard trigger box and On Overlap Begin event. The problem came to me when I used my own character class but I could replicate it when I just used any of UE4 example characters like the Third Person Character.

avatar image mightyenigma Jul 23 '18 at 09:28 PM

I think we need to see some of your code to figure this one out, specifically the part that handles the overlap event

avatar image Chibey Jul 23 '18 at 09:44 PM
 void AUsernamePlatform::OnOverlapBegin(UPrimitiveComponent * OverlappedComp, AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
 {
     ATopDownCharacter* playerRef = Cast<ATopDownCharacter>(OtherActor);
     if (!ensure(playerRef != nullptr))return;
 
     UPuzzleGameInstance* gameInstance = Cast<UPuzzleGameInstance>(playerRef->GetGameInstance());
     if (!ensure(gameInstance != nullptr))return;
 
     gameInstance->LoadUsernameMenu();
 
 
 }

There is the overlap event. I can keep supplying whatever you need but I swear it's something to do with the "Player Spawn BP". From what I understand, it spawns in an instance of the player class that is chosen in the GameMode. It's as if for every character I spawn in, they are all connected. I've tried having another character already existing in the level before spawning more characters in and the original seemed to have no connection to the ones spawned in while the spawned in ones continued to trigger events for one another.

avatar image mightyenigma Aug 10 '18 at 04:09 PM

How is the function that plays the announcement sound called?

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

0 answers: sort voted first
Be the first one to answer this question
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