Killing enemies behind boxes?

Do we ever address the issue of killing stuff hidden behind walls/boxes (which we can do).

2 options - Aim at exposed body or easier hit the wall/box first and not let it pass through.

Along the same lines… Shouldn’t projectiles stop when they hit the buildings or hill side?

My solution to that was the second option. Fire a shot and when it hits something, it tries to damage it.

I first make sure it’s not an accidental collision with the shooter
Then check to see if the collider’s gameObject has a Heatlh component, and damage it appropriately
Then destroy the arrow. Whether it’s a wall or an enemy, you hit something, so stop.

for me I put a check for health and projectile in the on trigger enter with if they don’t have these things then just destroy the projectile.

Before when I tried just health the arrows hit each other and stopped or poofed, hence why I added projectile checking as well. You could change it to have arrows stick in a shield or something for some amount of time with some more editting as well.

Privacy & Terms