Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Starting movement one particle after another

Discussion in 'Visual Effect Graph' started by SgtLame, May 25, 2023.

  1. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Hi,
    I started working with the vfx graph in Unity and things are going pretty well so far, except for one operation I can't achieve: I have a square grid of particles spawned with a single burst. Then the particles should just move up until their lifetime is over, no problem with that. What I need to achieve is the particles starting to move one after another, e.g. with a delay between each particle starting to move. I've searched docs and tutorials with no luck, which makes me ashamed because I have the feeling this should be fairly simple. Can someone help the noob? ^^'
     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,108
    If they must be spawned at the same time, but start with delay then the easiest way I can think of is to assign some "startTime" to each particle, it can be simply
    delay * spawnIndex + currentTime
    , then you check every frame if that number is smaller than current frame time to see if enogh time passed. If this evaluates to true you eable some block you want, in your case "add position" (multiplied by delta time to make it move smooth).
     
    SgtLame likes this.
  3. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Thank you very much!
     
  4. Marie_G

    Marie_G

    Unity Technologies

    Joined:
    Mar 9, 2021
    Posts:
    48
    Hello, My guess would be that you can also add a time offset based on particle ID. If the particle movement is based on their lifetime, you might be able to change age depending on particle id so their lifetime starts reducing only when needed.
    I you have other attributes that are changed based on particle's lifetime, you might need to store values in a custom attribute and use the position change in "custom" mode instead of over lfietime
    Unity_l0X9ygsUGI.gif
     
    Vita- and SgtLame like this.
  5. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Thank you Marie!