Search code examples
c#androidunity-game-engineparticle-system

Unity - How to emit particles in 45 degree steps?


I recently found an nice app, which uses a cool cartoon like splash effect.

It Looks like this :

Picture

I marked it with the black arrow...

I tried to create it with the Unity particle System, but somehow i cant manage it to emit particles in 45 degree steps... In their Particle System UI isnt an Option for that.

Does anyone know how to do that ? Or is there an solution to do this through a script ?


Solution

  • Assuming you are using Unity 5.6:

    Create a new particle system. Set the following properties:

    Looping: No
    Emission
        Rate over Time: 0
        Rate over Distance: 0
      Add 1 burst:
        Time: 0.00
        Min: 8
        Max: 8
        Cycles: 1
    
    Shape
        Shape: Circle
        Radius: 2 (or whatever value you want the minimum radius of the shape to be)
        Arc: 360
          Mode: Burst Spread
          Spread: 0.125
        Emit from Edge: Yes
        Align To Direction: No
        Randomize Direction: 0
        Spherize Direction: 0
    
    Renderer
        Render Mode: Stretched Billboard
        Length Scale: 2
    

    If you want to change how many particles are emitted, change Min/Max on the burst from 8 to X, and then set Spread on the Shape to 1/X, where X is the number of particles you want to emit.

    To make longer lines, increase the Renderer's Length Scale and the Shape's Radius.

    You may also want to play with the Limit Velocity over Lifetime module. I tried setting Start Speed to 15, turning on the Limit Velocity module and setting its Speed to 1 and Dampening to 0.125, which gave an interesting effect.