Search Unity

Question rotate spawned particles to face origin of Set Position (Shape: Arc Circle)

Discussion in 'Visual Effect Graph' started by mchangxe, Dec 8, 2022.

  1. mchangxe

    mchangxe

    Joined:
    Jun 16, 2019
    Posts:
    69
    Hey guys, Im wondering how I can rotate each individual particle so that they all face the origin of the circle they are emitting from. Ideally, they should all face a line from the origin of the cirlce pointing straight out of the paper (axis X in the screenshot below):

    upload_2022-12-8_13-9-59.png
    in this screenshot, Ive drawn the desired orientation of each point. For every point, their orientation should be the save as the tanget of the circle at that point.

    I know Set Position (Shape: Arc Circle) stores in the direction attribute a vector between the spawned position and the origin of the circle, but Im struggling to find the math that will rotate the particle to face such a direction.

    What Ive tried so far:
    Ive treid the orient block in Output Particle Quad set to face a line with points (0, 0, 0) and (1, 0, 0), but the result is quite weird. So I dont think orient is the way to do this? Im looking for a specific rotation around the x axis for each particle so that they face the origin of the circle.
     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,307
    upload_2022-12-8_11-11-14.png

    If this is wierd because they kind of rotate towards camera then you can use orient:advanced,
    or the second way - calculate the initial rotation in Init context using LookAt, but you need safe check for collinear up with direction.
     
    PaulDemeulenaere likes this.