Following and blowing up AI dealing damage through floors

I have problem… when i’m standing on first floor of the building enemy walks beneath me and during explosion i still got hit through the floor. Is there any way to prevent damaging through the walls/floors? AI isn’t trying to get to first floor… it just blows up when it is close enough in x and y axis instead being close enough in x, y and z axis… Any way to fix this?

AI is set up to get to my acctual possition and then blow up. but its just going on the same position in two instead of three axis.

Exactly, sorry for not being clear enough.

To clarify, your questions are:

  1. How to prevent damage through walls?
  2. How to make enemies blow up within certain range?

How to make enemies blow up within certain range?

You can do this in a couple of different ways, the one way I can think of right now is to have a Sphere Collision around your enemy. You can then build the logic when they trigger on overlap.

This still posses the issue of getting you on the floors below, if your radius clips through walls. A quick fix is to do a [LineTraceByChannel][2] from your enemy to your player. This will produce to following:

Is really simple the code and it will return false if it is not the right character

With this I’d suggest reviewing the different LineTrace Methods and read some of the documentation. This will help you make the right decision for your game.

For the explosions itself, I don’t think they will explode now if you implement some form of Line Trace. If this is still an issue I would post a separate question with your configuration for explosions and damage.

No worries, I just wanted to make sure I provided the right information.

You rules :slight_smile:
For now i’ve done blowing over overlap and it works perfectly.
Had no time for now to check Line TraceByChannel (I will have to check few methods)but i’m sure it will work too!
Thank you for help and quick answer.