Problems with Hit Detection

Hi, I am building a simple sidescroller in which the world is constantly moving and the player has to jump over obstacles. I have set up the game so that the world is actually moving and the player itself is only animated as if he was moving but actually standing still in space (with the exception of the jump). My aim is to stop the world movement on hit detection - for instance player runs into obstacle.

I have set up both player and obstacles as “block all dynamic” and ticked “generate hit events”. The obstacle is a simple static mesh with a box collision on it. When the player runs into an obstacle, he is indeed blocked and pushed out of the screen. However the “on component hit” of the obstacle doesn’t fire. It only does so, when I jump. Could it have something to do with my fake animation setup?

Any suggestions?

Hi 4ndy,
for the collision box try using the “Actor Begin Overlap” event and see if that triggers.

Hi Weaver,
the obstacles and the rest of the world are components of one blueprint that controls everything. So just the event with no actor reference in that blueprint doesn’t work (I tried it, though). I have tried the event actor begin overlap on the character with no result. I have also tried on component overlap function. The overlap event only fires when I set character and obstacles to collsion overlap all dynamic. But then the obstacles don’t block the character.

Maybe additional component, with different collision overlap, attached to obstacle can help? One component for overlap events and another for blocking.

I was trying to avoid that since the world consists of components in a single blueprint, so it seemed alittle cumbersome to me to add special overlay boxes as everyting moves… but i guess I can track the position of the obstacles and overlay them with an invisible “collision overlap” box. I still think it is supposed to work “the regular” way, though…

That is exactly what I’m talking about. Single blueprint components can contain separate “collision overlap” boxes for every obstacle. Just position them right at obstacle components or locations if obstacles represented as single component.

Yes, but I am actually moving the obstacles and not the player, so I guess I have to track there movement…