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"

No callback received for ReceiveHit or OnComponentHit

Hi.

I am on UE 4.5.

I have the following two actors configured as shown in the screenshot below. Both actors have SimulatePhysics = true and SimulationGenerateHitEvents = true on their RootComponent which is BoxComponent (collider). The StaticMeshComponent inside the [Root] has collisions disabled.

Actor1 is of type WorldStatic listening for Hit events when collided with the playerBullet. playerBullet is a custom trace channel. Actor2 is of type playerBullet that the player fires toward Actor1. When they come in contact none of the mentioned events gets fired :(.

However, if I change the collision response to overlap, I receive the following callback without any problem:

 virtual void ReceiveActorBeginOverlap(AActor* OtherActor) OVERRIDE;

In C++ code, I override the ReceiveHit method

 virtual void ReceiveHit(class UPrimitiveComponent* MyComp, AActor* Other, class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult& Hit) OVERRIDE;

And, hooked the OnComponentHit as below

 void AAIBeaconConnection::PostInitializeComponents()
 {
     Super::PostInitializeComponents();
 
     Collider = Cast<UBoxComponent>(RootComponent);
     Collider->OnComponentHit.AddDynamic(this, &AAIBeaconConnection::OnHit);
 }

I tried several other combinations but fail to get any of these events. I could work with overlap events but I would like to establish a clear distinction between blocking and non-blocking gameobjects in my game.

Any help is greatly appreciated!!

Actor1 Actor2

Product Version: Not Selected
Tags:
actor2.png (53.6 kB)
actor1.png (51.4 kB)
more ▼

asked Feb 21 '15 at 03:36 AM in C++ Programming

avatar image

Anshul
153 9 12 216

avatar image Lojo Feb 21 '15 at 04:55 AM

Just in case it's something silly... are you by chance using the event in Blueprint and forgetting to add a parent call?

avatar image Anshul Feb 21 '15 at 05:55 AM

No. I am not using it in the blueprint. Its all in C++. This blueprint is created from a custom class AIBeaconConnection which extends from AActor.

This is really bizarre that this is not working.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

So it looks like the solution described in the following thread works: https://answers.unrealengine.com/questions/127203/receivehit-not-called-when-hitting-boxtrigger.html

I do get both events (ReceiveHit and OnComponentHit) once I pass true as a second argument in my SetActorLocation() call.

I am not sure if its a bad function design but WHY setting the actor location is controlling which collision callbacks to call? This is really weird.

more ▼

answered Feb 21 '15 at 03:30 PM

avatar image

Anshul
153 9 12 216

(comments are locked)
10|2000 characters needed characters left
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