Rain that damages player, best coding practice?

Hello! In my next game, I will have a mechanic where rain damages the player when they are not in shelter. This will be a 3D game on a terrain, target platform PC/Console.

I had a couple ideas for implementation, but before I started, I wanted to get some feedback from others regarding performance, and/or ease of coding.

For one, I will be parenting the rain particle effect to my player (where each particle is using world space). This way the rain follows by player as they walk, and the player can walk forward through the rain. If I’m already doing this inefficiently, please let me know your ideas for displaying rain.

Then here were my ideas for detecting rain collision on player:

1. Each Raindrop particle sends a collision event on player (seems inefficient?)

2. Player detects collision from each raindrop (is this even different than the first method?)

3. If raining, set a couple raycasts up from my player to check if there is collision with shelter above me (technically this means rain doesn’t ever damage me, but rather I don’t get damaged if I’m under valid shelter. Feels not quite as direct as the other methods, but probably more performant.)

4. Create “safe” area trigger collider below all structural gameobjects, and when the user is in the collider, don’t take rain damage.

4 seems the easiest at first, but then I would have to set up every game object with a special rain collider, and that could be difficult in long term.

Any other ideas or methods that I’m unaware of? Thanks!

Unless you really need to model each rain drop (i.e unless its a core game mechanic) I would just maintain some sort of state for whether your player is sheltered or not. That could be automated by casting a ray up above the player and saying if there is cover at a certain distance then the player is sheltered by have zones that the player triggers by walking into/ out of.

them i would just deduct an amount of life for every n seconds spent out of cover whilst its raining.

if you really need it to be per particle then you can do per particle collisions but its going to be quite hard work for your computer.