Collision with two box components....?

Hey everyone! I’m trying to get two box components with the collision presets block all dynamic, with notify hit enabled binded to on component hit functions.

They detect and block the player and everything else but not each other which is what I want…
At the moment they just overlap one another and don’t detect each other!

Please can someone help me out, any help is much appreciated, thank you!!! :smiley:

Hello, I have a few questions:

  1. Are the two components in the same actor?
  2. Are they simulating physics?
  3. Can you please share part of the code that sets up the collision?
  1. No they are different actors
  2. No because when I press simulate physics they just fall into the void
  3. And I have just set it in blueprints both to block all dynamic and in one of them I have binded it to a on component hit function:
    BoxDetector->OnComponentHit.AddDynamic(this, &ACameraBoxes::OnBoxHit);
    And the function is called when it hits other things in the world like the player but not the other box component that I want it to detect, it just overlaps that

Also if I set up it so both boxes are set to overlap all and bind it to a component begin overlap function , it works perfectly and detects the other box

Ok, thanks for the information. Now one more question: What is making the box components move?

  • Are they attached to a Character/Pawn?
  • Are they being moved on their own via SetRelativeLocation or SetWorldLocation?
  • Are they attached to a different component which moves, which as a result, moves the box component?

Please by very specific

1 Like

Seeing as the OP isn’t responding to my request, I shall conclude my thoughts.

The OnHit events only work when one of the colliding components is simulating physics, or has a psuedo-physical movement component. So if one of said box components hits the other by just using SetActorLocation or SetComponentWorldLocation, and they are not simulating physics, the OnHit event won’t fire and they will overlap. This sort of collision requires physics to be enabled.

Now, there is a workaround. Most of the movement functions (SetActorLocation, SetRelativeLocation, etc.) have a sweep option. The makes it effectively use collision while moving, stopping the movement when a blocking object is hit. This would probably solve this. Otherwise, try using manual Traces and Sweeps.

1 Like

Sorry I didn’t reply dude! But thanks so much, I changed my code to make it work with overlaps as that is much easier and I will only use hit when working with physics objects. Thank you :slight_smile: