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"

UBoxComponent which is child of pawn not firing overlap events

I have a UBox Component that is a child of a Pawn. I move the UBoxComponent around independent of the pawn and it doesn't seem to generate hit events. I have done "show collision" and the collision components are overlapping. Here is the code I have for setting up the collision. (I have added more that I thought I needed in hopes it would fix the issue). I have checked the other objects I need to collide with and they all have bGenerateOverlap set to true.

         static FName HandCollsionProfileName(TEXT("OverlapAllDynamic"));
         CollisionComponent->bGenerateOverlapEvents = true;
         CollisionComponent->bMultiBodyOverlap = true;
         CollisionComponent->bTraceComplexOnMove = true;
         CollisionComponent->OnComponentBeginOverlap.AddDynamic(this, (Hand == EHand::Left ? &AVRPawn::OnCollisionLeftHand : &AVRPawn::OnCollisionRightHand));
Product Version: UE 4.10
more ▼

asked Nov 30 '15 at 06:09 AM in C++ Programming

avatar image

106 14 20 25

avatar image BlueByLiquid Dec 02 '15 at 06:32 PM

Anyone got any suggestions? I keep trying different things and nothing is working. :(

avatar image Doug E ♦♦ STAFF Dec 02 '15 at 09:58 PM

Hey BlueByLiquid-

It looks like you are trying to bind one of two functions based on "Hand" correct? Does the argument list of your OnCollisionLeft/RightHand functions match the argument list for OnComponentBeginOverlap? If you remove the ternary operator and only bind one function, does that function trigger when the box is overlapped?


Doug Wilson

avatar image BlueByLiquid Dec 03 '15 at 06:27 AM

Hey Doug! Thanks for the help.

When you made your suggestion I immediately thought, "Well that wouldn't be an issue unless 'AddDynamic' is a macro " so I dismissed it. Then I took a look at the function to see what was wrong and sure enough it IS a #define macro.

I thought the standard in UE4 source was to use all CAPS for Macro definitions. Am I wrong? It seems pretty confusing to do things this was as event the Delegate.h file has macros in all caps and macros not in caps.

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

1 answer: sort voted first

Hey BlueByLiquid-

To answer your question, we generally do use caps for macros. AddDynamic is a special "pseudo-member function" so it is made to look like one. The easiest solution would be to create a Dummy function to bind to your box component and have that function check the value of Hand and call either of the other two functions appropriately.


Doug Wilson

more ▼

answered Dec 03 '15 at 02:39 PM

(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