# Spawn particles around circle

Hey all, just have a quick question about ParticleEmitters. I'm working on a top down game and what I'm trying to do is spawn particles manually around the emitters center at a certain radius.

So as soon as the Emitter is set to emit I want it to generate 5 particles around the emitters center and the particle emitter will only run once.

I was just wondering

1. How do I manually spawn particles;
2. How do I position them at a radius evenly spaced around the center.

I have upload an image of what I mean.

http://imgur.com/8m4J1

The easiest way is to use a mesh particle emitter, with the mesh being a circle. Make sure "systematic" is on, and that "emit" is off. Then you can call Emit() yourself as necessary. The only slightly tricky bit is that Unity doesn't seem to like importing meshes that have no triangles, so either use a filled circle or make sure it has at least one triangle. It doesn't really matter either way since with systematic on the triangles aren't used anyway.

I haven't used particle emitters in Unity before, but I do know how to position things in a circle. ;)

You have to use trig, and calculate positions in a loop. In your example, you've positioned 5 points evenly. Here's a bit of (untested) code that does that:

Vector3 AxisOfRotation = new Vector3(0, 0, 1);
Vector3 ReferencePoint = new Vector3(1, 0, 0);

for (int i = 1; i < 6; i++)
{
Vector3 PositionOfParticle =  Quaternion.AngleAxis(Mathf.Acos(2 * Mathf.PI / i), AxisOfRotation)*ReferencePoint;
}

The code snippet just rotates a vector around an axis 5 times. If you want to apply a radius other than one, just scale the ReferencePoint vector to another magnitude.

You could have as many emitters as you want points (5 in your example) all pointing radially out from a common center, set to emit 1 (min and max) particle (and all other vars set identically), and set all their 'emit's to true at the same time.