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!