I am trying to make changes to the following particle system.
http://create.msdn.com/en-US/education/catalog/sample/particle_3d
I have such a function that when I click Space, all particles have their positions and speeds set to 0.
for (int i = 0; i < particles.GetLength(0); i++)
{
particles[i].Position = Vector3.Zero;
particles[i].Velocity = Vector3.Zero;
}
However, when I press the spacebar, the particles are still moving. If I go to FireParticleSystem.cs, I can rotate the settings. Gravity is up to 0 and the particles stop moving, but the particles are still not moving (0,0,0).
As I understand it, the problem is that the GPU processes all the positions of the particles and calculates where the particles should be based on their starting position, their initial speed and multiplying by their age. Therefore, all I managed to do was change the initial position and particle velocity, but I can’t do it on the fly, since the GPU processes everything.
I want the CPU to calculate the positions of the particles individually. This is due to the fact that later I will introduce some kind of wind to push particles around. How to stop the capture of the GPU? I think this has something to do with VertexBuffers and the draw function, but I don't know how to change it to make it work.
Helix source
share