CapsuleComponent - Detect Collision Direction?

Is there a way to detect which side of a capsule collision component a hit/overlay occurs? (i.e., collision on the right, use the output to make character fall left… collision on the left, use the output to make the character fall right?

Right now, I’m using two collision boxes and ignoring the capsule (default with character class). Seems highly inefficient. Looking for a better way.

Hey there,

Off the top of my head, I think you could use the capsule collision like this:

As an example, lets say you’re trying to detect which direction an arrow hit you.

  • At the moment the projectile hits
    you(your capsule), you would grab
    its(the arrow’s) location and
    rotation relative to yourself. You’d
    then have to use some behind the
    scenes math to determine the angle at
    which you’re hit.

Though it might take more than just having multiple hit boxes around your character, this will be far more accurate.

Yes, a “Hit Event” has a ton of information, including the normal vector (direction the hit occurred in). You can use that information to deduce which side of your capsule the hit came from. You could also simply compare the location of your capsule vs the location of the object that hit you (the object that hit you is also part of the hit event information).

I thought “Event Hit” and “OnComponentHit” were for physics based interactions? I’m not using physics. I’ve tried using both in the past and nothing happened. Maybe I did something wrong, not sure.

I was able to get this working without physics enabled. Apparently, the collision component has to parent the mesh, otherwise hit events don’t occur.

1 Like