Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Seperating newest particle, and keeping particle strip head on target

Discussion in 'Visual Effect Graph' started by BluWeeth, Nov 18, 2022.

  1. BluWeeth

    BluWeeth

    Joined:
    Nov 18, 2022
    Posts:
    1
    I'm trying to make a simple trail effect, similar to what the Trail Renderer would produce. I've got the basics down well enough, but the main problem I'm having at the moment is the start of the trail spawning in chunks that lag behind until the next particle is spawned, rather then tracking the current emitter position.

    The easiest fix would be to crank up the emission rate, but it seems wasteful to do that just for the start of the trail, given I can get away with a pretty low emission rate otherwise.

    So what I'm trying to do is treat the most recently spawned particle separately from the others, by having it track the emitter instead of staying in place.

    Which leads me to my main question: Is there a way to have a particle keep track of whether it's the "most recent" particle? Currently, I'm using the somewhat hacky solution of using the particle's current age, which mostly works but unsurprisingly has precision issues to work around.

    In my mind, it feels like a possible solution could be to somehow store the most recent particleid whenever a particle is emitted, and have subsequent particles compare their own id to that one. However, I don't know how to make that in the graph, nor do I know if that's even feasible/performant for the architecture.

    I'm using URP currently, though I would be interested if pipeline would even make a difference here. At any rate, any help would be appreciated!