# Calculating the correct particle angle in an outwards explosion

I'm creating a simple particle explosion but am stuck in finding the correct angle to rotate my particle. The effect I'm going for is similar to this:

Where each particle is going outwards from the point of origin and at the correct angle. This is what I currently have:

As you can see, each particle is facing the same angle, but I'm having a little difficulty figuring out the correct angle. I have the vector for the point of emission and the new vector for each particle, how can I use this to calculate the angle?

Some code for reference:

`````` private Particle CreateParticle()
{
...

Vector2 velocity = new Vector2(2.0f * (float)(random.NextDouble() * 2 - 1), 2.0f * (float)(random.NextDouble() * 2 - 1));

direction = velocity - ParticleLocation;

float angle = (float)Math.Atan2(direction.Y, direction.X);

...

return new Particle(texture, position, velocity, angle, angularVelocity, color, size, ttl, EmitterLocation);
}
``````

I am then using the angle created as so in my particles Draw method:

``````spriteBatch.Draw(Texture, Position, null, Color, Angle, origin, Size, SpriteEffects.None, 0f);
``````
-

First figure out the direction based on where the particle is in reference to where it came from (the explosion). Then you take the arc-tangent of that to get the angle.

``````Vector2 direction = particlePosition - explosionPosition;
float angle = Math.Atan2(direction.Y, direction.X);
``````
-
This is was I had originally done, but it hasn't made any difference. The original sprite image is a small image with the particle drawn horizontally. Check my edits for code. – Sun Sep 6 '12 at 20:23
No matter, I've solved it. I was using the original velocity value rather than the updated velocity of each particle.Thx. – Sun Sep 6 '12 at 20:28

Since your particles have a velocity you must have a velocity vector. Let's call the components `vx`and `vy`. You can then get the angle using:

``````atan2(vy, vx)
``````
-