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

Resolved Particle spread when rotating

Discussion in 'Visual Effect Graph' started by plehannowww, Apr 14, 2022.

  1. plehannowww

    plehannowww

    Joined:
    Nov 10, 2020
    Posts:
    11
    Hello! I have blood effect that must throwing particles in front line. It work only when Y angle is 0,90,180 etc, but when rotating is 1-89 effects have spread. Why?
     

    Attached Files:

  2. VladVNeykov

    VladVNeykov

    Unity Technologies

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

    Not quite sure what's happening, will share with the team after the Easter holiday to take a look. In the meantime, you can use a Set Velocity from Direction & Speed (New Direction) block, and then add some random velocity after to increase the spread a bit:
     

    Attached Files:

    plehannowww likes this.
  3. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,291
    Isn't that caused by the fact you are doing this per component?
    For instance if there is
    Set Velocity Random
    with:
    • A = (0, 0, 0)
    • B = (0, 0, 1)
    They are transformed by object rotation (45 deg), so vector A is still zero, but vector B will be (0.707, 0, 0.707), so you get random numbers between 0 and 0.707 on X and Z axis. When you do this per component it means you randomize separately for XYZ and in result you might get vectors like:
    • (0, 0, 0.7)
    • (0.7, 0, 0)
    • (0.7, 0, 0.7)
    Try uniform mode so one random number is "scaling" the vector and you should get vectors like:
    • (0.1, 0, 0.1)
    • (0.35, 0, 0.35)
    • (0.7, 0, 0.7)
    However personally I prefer Vlad's method most of the time (set from direction) as it works well with Set Position Shape blocks.
     
    Last edited: Apr 16, 2022
    VladVNeykov and plehannowww like this.
  4. plehannowww

    plehannowww

    Joined:
    Nov 10, 2020
    Posts:
    11
    @VladVNeykov Thanks for your answer. I tried your options and it have the same problem.

    @Qriva, I hope that I understand your explanation and i think it looks true, but even with Vlad`s version it looks like:

    upload_2022-4-18_13-35-38.gif

    upload_2022-4-18_12-42-26.png
     
  5. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hey @plehannowww ,

    Try changing the 7 here to a 1:


    You are setting the directionality with the Set Velocity from Direction & Speed block, if you need it to go faster increase the Speed value there. The Add Velocity below it is to introduce a bit of a spread.
     

    Attached Files:

    Qriva and plehannowww like this.
  6. plehannowww

    plehannowww

    Joined:
    Nov 10, 2020
    Posts:
    11
    I needed to inscrese lenght of blood, like green box on the screen, because i tried to changed Z to 7. Then i changed speed, as you adviced me, and added Random Number to increase lenght of blood and it works! Now there is no spreading when I rotating the player. Thank you!
    upload_2022-4-18_15-2-5.png upload_2022-4-18_15-3-25.png
     
    VladVNeykov likes this.
  7. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Glad this works! :)
    This is legit, just FYI, you can simplify this a bit as there's already a built-in random option:
     

    Attached Files:

    plehannowww likes this.