What would the best/most efficient way to make an explosion damage players via raycasting?

I can think of two ways to do this.

  1. Cast a bunch of rays out from the origin of the explosion, check if what they hit is a player, if it is a player and they are within a certain vicinity, damage them.

  2. Get every player within the game, and cast a ray from the explosion to the direction of their torso. If the ray isn’t interrupted and they are within a certain vicinity of the explosion, damage them.

Which way is best (if any)? Thank you.

You can use the second option and calculate the direction by using (PlayerPosition-ExplosionPosition).Unit*Range. You could also use OverlapParams with the explosion region, but wouldn’t be too efficient.

Alright, I’ll try that. Thank you :)