Gaps in particle system when following player

I have a snow particle system in world space that follows the player, but when I move enough there is a gap in the particle system.

3443f

Is there a way to keep it constant without setting it to local space cause I need the particles to move past the player.

1 Like

What is generally desired for situations like this is a solution that teleports offscreen particles back onto the screen, so that the effect appears to be “infinite” but is really only simulating in a small area around the player.

This can be achieved with some scripting, but there is nothing built-in to the Particle System to solve this.

The general idea could be something like:

  • define a bounding box that is attached to the camera
  • on each frame, check each particle position. If the particle is outside the box, teleport it to the other side of the box (i.e. move from X to -X, (or -X to X) and Y to -Y or (-Y to Y) (probably no need to worry about vertical)

There are 2 ways in Unity to do this:

2 Likes

Hey richardkettlewell,
I’m trying to achieve this for 2D rain and snow. I understand what you are suggesting, but have no idea how to actually go about it. I’ve checked the documentation, but it didn’t help much. I should add, I’m not much of a coder :smile:.

Would You happen have any examples of the code? I imagine it shouldn’t be that difficult in 2D.

Thank You in advance and Happy Holidays!