Search Unity

World Space issues

Discussion in 'Visual Effect Graph' started by Rangerz132, Apr 7, 2020.

  1. Rangerz132

    Rangerz132

    Joined:
    Feb 3, 2019
    Posts:
    38
    Hi everyone! I'm currently learning Visual Effect Graph and I have some issues with the World Space System.

    In each main node (Spawn, Initialize, Update, Output), there is a LOCAL / WORLD button.

    I need to spawn some VFX at some positions in the world but it seems that the world Space button doest work. It always stay at the center (0,0,0).

    Do you have the same issues?

    Thanks you
     
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

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

    By default, all particles start at (0,0,0). In this example, the VFX asset is at (3,2,0). when the space is set to world, the default particle position (0,0,0) will be at the world origin, displayed in the lower-left corner in this gif. When you switch it to local space, the particles still spawn at (0,0,0), but local to the VFX Game Object, which is at (3,2,0).



    You can set particle positions with blocks such as Set Position. Keep in mind that these blocks are "spaceable", which means that you can set the position via them in World or Local space (the little W/L toggle):
    upload_2020-4-13_16-26-36.png

    As an example, here is a system in World space, with a Set Position block added. Changing the Set Position block's space from World to Local will move the new position from the world origin (0,0,0) to the game object's origin (3,2,0). If we set it to (0,1,0), it will set the particle positions to 1 up on the Y axis either from the World origin (to (0,1,0) when the block is setting a World position) or 1 unit up on the Y axis from the VFX's origin (to (3,3,0) when the block is set to a Local position):


    Hope this helps!
     

    Attached Files:

    Nielsvdmarel and pahe like this.
  3. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    240
    Expanding on the question: my goal is to have the initial particle position controlled locally, while the update should take place in the world space (turbulence etc). HDRP 8.2 (so no transform matrix local<>space like in v. 10). Particle Strips scenario. The answer above does not work for the strips, the seem to move, but a very short distance. New to VFX graph, so would appreciate if someone could point me in the right direction.
     
  4. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    Hi,

    How can i simply move the particles when world space is needed ? I drag the tranform and does not move.

    This makes the graph unusable
     
  5. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi! World space is explicitly used to not take the position of the VFX Graph's game object transform into consideration (as that would constitute Local space). If you'd like for particles to spawn where your transform is, but remain after this in world space, you can have you system in world space and just set your position to be in Local space:


    If you don't want your particles to remain behind when you drag the transform around at all, then your system should be in Local space.
     

    Attached Files:

  6. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    Hi, thanks a lot for the help on this, i tested it and works as needed, when i pass the Transform node to the Set Position in the Intitialize.

    Btw, i see i can add the Set Position in the Update too, is this needed so the transform is tracked as it moves in the scene ?

    Thanks for all the insight on this.
     
  7. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    What is the end result you are hoping to accomplish? If you'd like the particles to always follow the transform, you can set the system in Local space.

    If you leave it in world space and add a Set Position in Update, all particles will confirm to it each frame. Not only won't they trail behind if you move the transform (one of the main use cases of having a system in World space), but they won't do anything else if you've had any velocity blocks, turbulence, etc. You'll just get a lot of particles in the same spot :)

    So what's the end goal?
     
    nasos_333 likes this.
  8. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    Hi,

    I want to take the bon fire HDRP sample VFX and copy it around the scene in various places based on surface normal.

    But when i did this with the current VFX the smoke went towards the normal than up, so i fixed it by following your advise to put the Transform position into the position node in Init. If i put in update does not work indeed.
     
    VladVNeykov likes this.
  9. plehannowww

    plehannowww

    Joined:
    Nov 10, 2020
    Posts:
    11

    Thank you so much, i was scrolling internet for 4 hours to find the solution
     
    VladVNeykov likes this.