Search Unity

Rotating Point Cache within VFX Graph

Discussion in 'Visual Effect Graph' started by LucasRizzotto, Jan 26, 2021.

  1. LucasRizzotto

    LucasRizzotto

    Joined:
    Dec 11, 2015
    Posts:
    27
    Hey, all! So my VFX Graph is based on a PointCache and is "attached" to a Transform Property Binder so the graph can be moved by another transform.

    MyGraph.png

    This works pretty well since Set Position From Map lets me add the binder's scale and position... However, there's no option for rotation, causing it to look like this:

    GraphResult.png

    So here's my question... how can I rotate my PointCache particles's spawn locations so they match the Transform in the Property Binder?
     
  2. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    589
    I don't have an example handy, but you have to use GetCurrent to get the current particle, and perform the transform on it. Essentially shifting the particles one by one after they are created.
     
  3. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    326
    Hi, for your information, a new SamplePointCache operator is added from 10.3. This allows to perform transformations on the fetched point cache data before setting particle attributes.
     
  4. LucasRizzotto

    LucasRizzotto

    Joined:
    Dec 11, 2015
    Posts:
    27
    I have gotten it to work, but only partially. This works with some rotations, but not all. Any tips?

    Unfortunately this has to work in 2019.4 so I can't use any 2021 beta features.
     

    Attached Files:

    Last edited: Feb 5, 2021
  5. LucasRizzotto

    LucasRizzotto

    Joined:
    Dec 11, 2015
    Posts:
    27
    Lol the solution is so much more simpler than I could have ever imagined

    Just use the Transform (Position) node.

    positionyay.png
     
    noobcoodoocoo likes this.
  6. VladVNeykov

    VladVNeykov

    Unity Technologies

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

    This looks a bit overcomplicated :)
    You can just set the pCache position as usual and then just transform the position with the transform of your object in the scene.


    And the result:
     

    Attached Files:

    florianBrn likes this.