Download

Two collision components - how to fire Begin Overlap Event once?

Hi

In general the question is like in the title. I do have two collision objects in my character, one is for the environment, the other one is for user input (Touch Event). I do need it this way as the penguin moves quite fast, so the hit box for touch events must be bigger than the penguin for the usability reasons, and the environemt collider must be smaller to match the collisions with the visuals and the speed of the gameplay.

That’s the gameplay screen to give you an idea of what we are talking about here:

So the penguin needs to look something like that:

Every time he drops down a level, which is simply having a trigger on the image below, a Begin Overalp event is fired.
460e791e2100cb0f9a079345638bb00ac5b55889.jpeg

The function that is fired by this event looks like this:
e3e51549461f09065be627a75769e8a5d2eae0c5.jpeg

But it gets fired twice, as both of the collision components from the penguin are firing the Begin Overlap Event. If I turn off the Overlap Events for the hit box collider the input stops working as well… So basically what I’m looking for is some help in identifing which of the collision components are overlaping with the platform trigger and take that into account in my score increasing mechanics. I did try to do some research but didn’t find the answer I was looking for, if anyone knows the answer or simply where can I find it, I will be really greatfull.

Hello,
If you set your event in your character, you can use capsule begin overlap instead of actor
If you set it in actors in level, you may can use a “get overlapping components” with a branch : true if capsule is in array, false if it is not,
( or if you use an event hit : break hit and use the other comp output to check it )

Hi Fen

Thanks for your tips. I have been experimenting all the time as I wanted to avoid moving the logic to the character BP (that was the right thing to do probably) and… I have just found a solution:

I did it this way because using the Get Overlapping Components connected to the Other Actor or Other Comp outputs was giving me the name of my level trigger component twice. That is probably because they are already referencing to the other object so it turned out to be much simpler in the end. It turns out the most primitive Cast and Branch combo did the trick. No need to use anything else :smiley:

Looking at the solution now it all looks trivial. But sometimes you just need to reset your thinking.

Oh yeah, i forgot that component begin overlap had other component output too (as event hit) which is the easier. Thanks for remainder and happy that you solved it ^^