0
\$\begingroup\$

I'm working on a visual effect using particle systems.

I'm trying to rotate newly created particles according to some object's velocity at that time.

Currently, I'm rotating the entire particle system and I use the "Align To Direction" option in the "Shape" options.

It works fine, until I change the velocity of the object - then it rotates every existing particle too.

How can I rotate particles when they are created?

\$\endgroup\$
2
  • \$\begingroup\$ What simulation space are you using? \$\endgroup\$
    – DMGregory
    Jun 30, 2020 at 16:34
  • \$\begingroup\$ World (the game im doing this in, is also 2D btw) \$\endgroup\$
    – nir shahar
    Jun 30, 2020 at 16:36

1 Answer 1

0
\$\begingroup\$

I just ran into this problem when converting flying bullet casings and empty clips objects into particles when they stop and hit the ground. I was unsuccessfully trying to get the rotation to match. You can set the emit params, but the trick in my case was to use a negative rotation value on the PS. 2D top down (looking down Z-axis). Here's a simple solution:

    var emitParams = new ParticleSystem.EmitParams();
    emitParams.position = transform.position;
    emitParams.rotation = -transform.rotation.eulerAngles.z;
    
    casingPS.Emit(emitParams, 1);
    Destroy(gameObject);

Hope it helps, it took me ages to figure this out.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .