Commits

rude  committed 8a2bacd

Particles now have fixed origin. (ParticleSystem::SetPosition will only affect
new particles, and existing particles will not gravitate against the new point).

This is another requirement to implement ParticleSystem in GLSL.

  • Participants
  • Parent commits 914e4d8

Comments (0)

Files changed (2)

File src/modules/graphics/opengl/ParticleSystem.cpp

 		max = direction + spread/2.0f;
 		pLast->direction = (rand() / (float(RAND_MAX)+1)) * (max - min) + min;
 
+		pLast->origin = position;
+
 		min = speedMin;
 		max = speedMax;
 		float speed = (rand() / (float(RAND_MAX)+1)) * (max - min) + min;
 				love::Vector ppos(p->position[0], p->position[1]);
 
 				// Get vector from particle center to particle.
-				radial = ppos - position;
+				radial = ppos - p->origin;
 				radial.normalize();
 				tangential = radial;
 

File src/modules/graphics/opengl/ParticleSystem.h

 		float position[2];
 		float direction;
 
+		// Particles gravitate towards this point.
+		love::Vector origin;
+
 		love::Vector speed;
 		float gravity;
 		float radialAcceleration;