Download

How to Enable Self Collision with Components of the same Blueprint?

I’m making a simple worm game, the body of the worm is a growing array of static mesh components (cubes) and the collider (a box component) is always re-parented to the last element of the array (the head).
My idea is, if the collider hit a static mesh component that is not it’s parent (the head), then it means the worm hit his body so is game over.
Problem is, I can’t get my Collider to generate Overlap Event with the other static mesh components inside the same Blueprint… furthermore, as you see in the image below I am even getting a warning, which I don’t quite understand.
How should I do in order to have my collider generate those overlap events? :confused:

You can use “Get Overlapping Components” from your collider (BoxCollision) and check if you are overlapping your own Mesh. Also, you can check if the owner = self.

The warning sign will display a message if you put your mouse over it for a sec. I guess the problem is that the OtherActor input will never cast successfully to a StaticMeshComponent, because it is an Actor class ref.

The problem with this is that the check has to happen in Event Tick.
I want for the self overlap to be detected by default thus firing EventActorBeginOverlap, and then I check there, if is a component other than the head. Is this feasable, or EventActorBeginOverlap cannot be triggered by components of the same Actor?

Ok, I think I see the problem, I had the mesh components set to “Generate Overlap Event” and “No Collision”, I’ve changed it to Overlap All and now it works :S