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"

Collision event not firing

Hi there,

i have an actor with which is overriding ReceiveHit(...)

When I hit the actor with the pawn, ReceiveHit gets called.

When the actor hits a boxtrigger (collision settings: block all), ReceiveHit doesn't get called.

It would be nice if i could get the Hit event from the box :)

thanks in advance :)

edit: When i set the

CollisionComponent->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Block);

to

CollisionComponent->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Overlap);

i get overlap events. This is weird because all the other objects which this one is colliding with, are set to "block all " One of those objects has not checked the Generate overlap events, but I'm getting overlap events on this object.

When the actor is set to "block all" there is no collision but with pawn and i dont get the overlap events.

Funny is that when i set simulate physics true the actor gets stopped by the objects but i dont get a ReceiveHit... can somebody tell me whats going on here? something is weird...

edit:

More clear version:

Ball Header

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

Ball CPP

void AG1Ball::ReceiveHit(class UPrimitiveComponent* MyComp, 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.f, FColor::Blue, TEXT("BALL HIT")); }

 void AG1Ball::ReceiveActorBeginOverlap(AActor* OtherActor)
 {
     GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("OVERLAP BEGIN"));
 }
 
 void AG1Ball::ReceiveActorEndOverlap(AActor* OtherActor)
 {
     GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("OVERLAP END"));
 }

Ball Constructor

CollisionComponent = PCIP.CreateDefaultSubobject(this, TEXT("SphereComp")); CollisionComponent->InitSphereRadius(30.0f); CollisionComponent->SetCollisionObjectType(ECC_WorldDynamic); CollisionComponent->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Block); CollisionComponent->SetCollisionEnabled(ECollisionEnabled::Type::QueryOnly); RootComponent = CollisionComponent;


Static Mesh in scene settings 1

alt text

Static Mesh in scene settings 2

alt text


Problem

he ball moves through the actor in the scene. None of the events (hit,overlap) get called.

Additional info

have a Pawn with the same settings as the static object in the scene.

If the pawn is not moving no event gets called.

If the pawn is moving the Hit event gets called.

Questions

hould i use virtual ReceiveHit / ReceiveActorBeginOverlap ... or should i use something like

 CollisionComponent->OnComponentHit.AddDynamic(this, &AG1Ball::OnHit);

Should i enable simulate physics on the static mesh or ball (ball is not falling its just moving)?

Product Version: Not Selected
Tags:
more ▼

asked Nov 02 '14 at 04:16 PM in C++ Programming

avatar image

oOo.DanBO.oOo
417 24 35 428

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

1 answer: sort voted first

its pretty simple:

Problem

etActorLocation(GetActorLocation() + Velocity * 0.005f);

Solution

SetActorLocation(GetActorLocation() + Velocity * 0.005f, true);

more ▼

answered Nov 04 '14 at 07:31 PM

avatar image

oOo.DanBO.oOo
417 24 35 428

(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