# Hit Event never occurs

**URL:** <https://forums.unrealengine.com/t/hit-event-never-occurs/406785>\
**Category:** World Creation\
**Tags:** unreal-engine, hit, Collision, CPP, question\
**Created:** [October 11, 2017, 9:44pm UTC](https://forums.unrealengine.com/t/hit-event-never-occurs/406785 "2017-10-11T21:44:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_4a5f074b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4a5f074b](https://forums.unrealengine.com/u/anonymous_user_4a5f074b)\
**Post date:** [October 11, 2017, 9:44pm UTC](https://forums.unrealengine.com/t/hit-event-never-occurs/406785/1 "2017-10-11T21:44:02Z")

</div>

Hello everyone!

I have a character class with following constructor:

```
ACharacter2D::ACharacter2D()
{
	PrimaryActorTick.bCanEverTick = true;

	Capsule = CreateDefaultSubobject<UCapsuleComponent>(TEXT("RootCapsule"));
	Capsule->bGenerateOverlapEvents = true;
	Capsule->SetNotifyRigidBodyCollision(true);
	Capsule->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
	Capsule->SetCollisionObjectType(ECC_Pawn);
	Capsule->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Block);
	Capsule->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap);
	Capsule->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
	Capsule->OnComponentHit.AddDynamic(this, &ACharacter2D::OnHit);

	RootComponent = Capsule;

	Movement = CreateDefaultSubobject<USimple2DMovement>(TEXT("2DMovement"));
	Movement->UpdatedComponent = RootComponent;

	AutoPossessPlayer = EAutoReceiveInput::Player0;
}

```

Function OnHit, that is binded to OnComponentHit, is defined as follows:

```
void ACharacter2D::OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, FVector NormalImpulse, const FHitResult& Hit)
{
	UE_LOG(LogClass, Warning, TEXT("Hit!"));
}

```

I constructed test level with blocks consisting of simple square sprites with following collision properties:

 ![216401-col.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/b/d/fbdb6f495dbb24a43455e0d76fde5ac5dcf9e725.png)

The thing is that this setup does not work at all.  
Event is being triggered neither by stepping on blocks nor by jumping or running into them.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4a5f074b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4a5f074b](https://forums.unrealengine.com/u/anonymous_user_4a5f074b)\
**Post date:** [October 12, 2017, 6:38am UTC](https://forums.unrealengine.com/t/hit-event-never-occurs/406785/2 "2017-10-12T06:38:03Z")

</div>

By the way, I am moving the character with

```
MoveUpdatedComponent(DesiredMovement * DeltaTime, UpdatedComponent->GetComponentRotation(), true, &Hit, ETeleportType::None)

```

function.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4a5f074b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4a5f074b](https://forums.unrealengine.com/u/anonymous_user_4a5f074b)\
**Post date:** [October 13, 2017, 9:26am UTC](https://forums.unrealengine.com/t/hit-event-never-occurs/406785/3 "2017-10-13T09:26:52Z")

</div>

Does anyone have any idea?

Tried moving the character with  
UpdatedComponent-\>SetLocation(UpdatedComponent-\>GetLocation() + DesiredMovement \* DeltaTime);  
Still no luck. Tried even dropping on him physics simulated object. Character blocks it, but hit event does not occur.
