• Advertisement
Sign in to follow this  

Question about a physics article

This topic is 3293 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been following a great physics article I have found, I am using xna game studio 3, and have had success implementing the theory and code into my own version in xna. However, not very far along, I have already run into a problem. Article (scroll down to third section) // Implements particles in a box void ParticleSystem::SatisfyConstraints() { for(int i=0; i<NUM_PARTICLES; i++) { // For all particles Vector3& x = m_x[i]; x = vmin(vmax(x, Vector3(0,0,0)), Vector3(1000,1000,1000)); } } I'm not sure how this code handles the particle collisions or how to put it into C#, I have understood the theory and code so far, just seemed to have hit a road block. help greatly appreciated.

Share this post


Link to post
Share on other sites
Advertisement
All that code snippet does is force the particles to stay in the box by projecting them out.

Quite literally:

for each particle
{
if particle.x < 0
particle.x = 0;
...
}

Share this post


Link to post
Share on other sites
Wow, I guess all it took was a simpler explanation, can't believe i missed the concept.

anyway, thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement