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"

Component End Overlap not working. C++

I'm trying to set up an Overlap End for a trigger box in c++. RepairStation is the name for this class. Here is the tBox set up.

In RepairStation.h

  UPROPERTY(EditAnywhere)  
     UShapeComponent *tBox;

In RepairStation.cpp // in constructor

 tBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Trigger Box"));  

 tBox->bGenerateOverlapEvents = true;  

  tBox->OnComponentEndOverlap.AddDynamic(this, &ARepairStation::TriggerExit);

   RootComponent = tBox;

TriggerExit function:

   void ARepairStation::TriggerExit(class AActor* OtherActor, class UPrimitiveComponent* OtherComp,int32OtherBodyIndex) 
          {
           //printing debug messages here
          }

Below I've displayed my working TriggerEnter function.

In RepairStation.h

   UFUNCTION()
     void TriggerEnter(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32         OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);

In RepairStation.cpp

   void ARepairStation::TriggerEnter( class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
  {                                 
 //Print debug message here
  }

  tBox->OnComponentBeginOverlap.AddDynamic(this, &ARepairStation::TriggerEnter); // in constructor

I currently have a working BEGIN overlap for the same tBox, set-up in the same way, although I pass a different delegate signature. The root problem is that the End Over lap function isn't working, while the begin overlap does.

Any help would he appreciated.

Thank you.

Product Version: UE 4.10
Tags:
more ▼

asked May 12 '16 at 03:31 PM in C++ Programming

avatar image

Dead-Beat
1 1 2 4

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

1 answer: sort voted first

Hey Dead-Beat-

There is a known issue that binding the OnComponentEndOverlap function does not trigger (UE-29879). You can instead use OnActorEndOverlap, any component that is set to trigger overlap events will then trigger the bound function.

Cheers

Doug Wilson

more ▼

answered May 12 '16 at 06:21 PM

avatar image Dead-Beat May 13 '16 at 12:37 PM

Hey Doug,

Thanks for the quick response. I actually managed to get it working last night. After I made sure all my code was right (to my knowledge) I simply drug a new instance of the class blue print into the editor and everything worked smoothly.

(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