Is it possible to script an explosion to not explode through a wall?

Recently I have been working on a Grenade system but I always had one question that I didn’t know the answer of.

Is there anyway I can script a explosion to not go through the wall.
If this doesnt make sense I mean: If my grenade explodes next to a wall, the player on the other side of the wall would still be affected by the explosion.

I would be happy to see your responses.

To be frank; there is no good workaround for this as you can either make it fire a bunch of rays on the explosion and check for a valid target; or you can also make a huge detection part that is within the bounds of the explosion and also check for a target (could also possibly lead to the same issues really.)

Or, the simplest fix of them all would be to make the explosion radius smaller or the wall bigger.

1 Like

Using the .Hit event you can skip the searching for valid parts; it gives distance which is nice for damage calculations.
Determine occlusion for each part then add functionality, could raycast for a special list of nade blocking parts between them.

Probably will need to remove BlastPressure and DestroyJointRadiusPercent. The pages have custom blast implementations worth looking at.

1 Like

My recommendation would be to add an additional raycast check, from the centerpoint of the explosion to the player and make sure theres nothing obstructing it from reaching the player that way.

Edit: though this might produce some behavior thats not favorable, like a player hiding behind a pole