# Function when actor collides

**URL:** <https://forums.unrealengine.com/t/function-when-actor-collides/301413>\
**Category:** World Creation\
**Tags:** oncomponenthit, unreal-engine, Collision, projectile, question\
**Created:** [December 12, 2014, 6:20pm UTC](https://forums.unrealengine.com/t/function-when-actor-collides/301413 "2014-12-12T18:20:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shrimperator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shrimperator](https://forums.unrealengine.com/u/Shrimperator)\
**Post date:** [December 12, 2014, 6:20pm UTC](https://forums.unrealengine.com/t/function-when-actor-collides/301413/1 "2014-12-12T18:20:30Z")

</div>

For a projectile, I need to get whenever my projectile hits any other object.

Fist I tried to use

```
MeshComponent->OnComponentHit.AddDynamic(this, &AProjectile::OnHit);

```

Unfortunately this is extremely unreliably (It only works when my projectile hits certain parts of my NPCs to be exact)

Then I tried to use the ReceiveHit-function like this:

```
void AProjectile::ReceiveHit(class UPrimitiveComponent * MyComp,
class AActor * Other,
class UPrimitiveComponent * OtherComp,
	bool bSelfMoved,
	FVector HitLocation,
	FVector HitNormal,
	FVector NormalImpulse,
	const FHitResult & Hit)
{
	Super::ReceiveHit(MyComp, Other, OtherComp, bSelfMoved, HitLocation, HitNormal, NormalImpulse, Hit);
	GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::Green, "ReceiveHit() Called");
}

```

But it is never called.

What am I doing wrong? How do I do this properly?

I also posted a thread in the forum, in case you need more information:

> **[Get Colliding Actors](https://forums.unrealengine.com/showthread.php?54019-Get-Colliding-Actors)**
>
> Very quick question: I know how to use GetOverlappingActors(), but is there a way to get the objects the character is “touching” without necessarily overlapping? Thank you in advance 🙂

---

<div class="post-metadata">

**Author:** ![joeGraf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joeGraf](https://forums.unrealengine.com/u/joeGraf)\
**Post date:** [December 13, 2014, 12:30am UTC](https://forums.unrealengine.com/t/function-when-actor-collides/301413/2 "2014-12-13T00:30:02Z")

</div>

Rather than binding an even to the component, I’d use overlap events. Look for

void ReceiveActorBeginOverlap(AActor\* Other)

---

<div class="post-metadata">

**Author:** ![Shrimperator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shrimperator](https://forums.unrealengine.com/u/Shrimperator)\
**Post date:** [December 13, 2014, 12:46am UTC](https://forums.unrealengine.com/t/function-when-actor-collides/301413/3 "2014-12-13T00:46:45Z")

</div>

I don’t need to get when it overlaps though but when my projectile actually collides with another actor. I have collision enabled on my projectile but still need to have some functionality when it hits another actor if this makes more sense.

---

<div class="post-metadata">

**Author:** ![joeGraf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joeGraf](https://forums.unrealengine.com/u/joeGraf)\
**Post date:** [December 13, 2014, 12:48am UTC](https://forums.unrealengine.com/t/function-when-actor-collides/301413/4 "2014-12-13T00:48:43Z")

</div>

Overlaps are collisions

---

<div class="post-metadata">

**Author:** ![Shrimperator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shrimperator](https://forums.unrealengine.com/u/Shrimperator)\
**Post date:** [December 13, 2014, 1:08am UTC](https://forums.unrealengine.com/t/function-when-actor-collides/301413/5 "2014-12-13T01:08:13Z")

</div>

Of course they are collisions, but not the ones I need right now 🙂

I have a projectile with simulate physics and blocking-collision enabled. Now I need to get when it hits another actor. When it bounces off a wall for example. ReceiveActorBeginOverlap doesn’t fire in this case.
