0

I'm new to unreal engine, I'm trying to add large force to an object with a box collider but after it collide with other object (just another instance) the overlap inside each others and become like one object and moving with each others.

Cab anyone explain their behavior and how i should resolve this?

iartist93
  • 315
  • 5
  • 18

2 Answers2

1

What happens here is that both objects collide with each other continously. To fix that you could try to deactive the OnOverlap()-Event on either the overlapping Object or the colliding object.

In blueprints you can achieve that by setting the Generate Overlap Events-Variable of one of the colliding static meshes of the overlapping objects to false.

In C++ you could simply remove the dynamic event callback for one of the colliding objects like that:

CollidingComponent->OnComponentBeginOverlap.RemoveDynamic(this, &ACollidingActor::OnBeginOverlap);

Where CollidingComponent is the component of your object, which causes the overlap event to trigger.

Alex
  • 133
  • 1
  • 1
  • 8
  • Unfortunately, this doesn't solve my problem! I'm still getting a weird behavior when they collide. The problem that sometimes they collide just fine and some other times they do that weird behavior. – iartist93 Nov 21 '17 at 19:34
1

Like @Alex said, they overlap with each other, over and over. If you didn't know, you can add breakpoints to your blueprint nodes, just like in your code, by right-clicking a node and select Enable Breakpoint (or smth like that). Your game will stop when reaching it and switch to that exact point in your blueprint. You can then hover over that node and see every variables value going in and out of it.

Hope this helps you learing to use the Unreal Engine.