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"

Hit Event never occurs

Hello everyone!

I have a character class with following constructor:

     PrimaryActorTick.bCanEverTick = true;
     Capsule = CreateDefaultSubobject<UCapsuleComponent>(TEXT("RootCapsule"));
     Capsule->bGenerateOverlapEvents = true;
     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:

alt text

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.

Product Version: UE 4.17
col.png (28.6 kB)
more ▼

asked Oct 11 '17 at 09:44 PM in Using UE4

avatar image

1 2 4

avatar image Iwrestledabeer Oct 12 '17 at 06:38 AM

By the way, I am moving the character with

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


avatar image Iwrestledabeer Oct 13 '17 at 09:26 AM

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.

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

0 answers: sort voted first
Be the first one to answer this question
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