Search Unity

Resolved Push particles outward from center

Discussion in 'Visual Effect Graph' started by FlightOfOne, Jan 19, 2021.

  1. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    Hello,

    How do I make these smoke particles go outwards only, e.g. after an explosion?

    I tried with negative and positive velocity but it comes back into the center and that is not what I want.

    Thanks!
    upload_2021-1-18_17-6-34.png upload_2021-1-18_17-6-53.png
     
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi @FlightOfOne ,

    You can subtract the particle position by the effect position (or whatever the center you want to move away from is) and normalize the value. This will give you a vector pointing from the center outwards to the particle. You can then multiply that value by the speed you desire. If your effect is in local space, you can even skip the subtract.

    Something like this:


    In 10.2.0 we also harmonized how different position blocks work, so if you are on that version or newer, you can also simply add a Set Velocity from Direction & Speed block as the direction will already be set automatically in the Set Position block:


    Hope this helps!
     

    Attached Files:

  3. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    @VladVNeykov

    Thank you so much for this!

    I am using 10.2.2 but I do not see that Set Velocity from the Direction block. Do I need to install anything else?

    This is all I see.
    upload_2021-1-20_10-56-35.png
     
  4. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    Nvm, I found it, guess it is an experimental feature. Had to enable from here: Edit > Preferences > VFX > Experimental Operators.

    And it worked, that was easy, thank you!
     
    VladVNeykov likes this.