I am programming a particle engine for a 3D game written in XNA. I was wondering if somebody could point me in the right direction or perhaps give me some pointers in making the particles collide with geometry in game. In essence, I want to be able to make a spark emitter that will bounce and collide down say, a cylindrical tube.
-
1\$\begingroup\$ Are you looking for engines that do this, how to manually implement it, or both? \$\endgroup\$– PrettyPrincessKitty FSCommented Oct 23, 2010 at 12:03
-
\$\begingroup\$ I am making an engine to do this for me. \$\endgroup\$– DaveCommented Oct 23, 2010 at 21:22
2 Answers
Particle mechanics isn't terribly difficult to understand in general, but there are some messy details.
The single biggest thing to remember is Truesdell's Axiom: "No two distinct masses may occupy the same point in space at the same point in time." Simulating particle dynamics is largely about creatively breaking that axiom, while still preserving physical plausibility.
There's several methods for enforcing non-penetration: measure differential inclusions, displacement based penalties, and velocity based restitution are fairly well developed computationally.
Since you're interested in gaming, I'd recommend focusing on restitution-based methods which produce diagonal systems of equations (i.e., you can solve them explicitly).
A good first reference for details is "D. Baraff, Dynamic Simulation of Non-Penetrating Rigid Bodies, (Ph. D thesis), Technical Report 92-1275, Computer Science Department, Cornell University, 1992."
I would start with Baraff's work and either Bullet or O.D.E. Work in parallel between theory and code.
Also, if you can find papers on Distinct Element Method by Peter Cundall, you might find those an easier entry point.
Particle interaction is very rich. Don't expect overnight success, and you will have a lot of fun.
For 3d physics, you can use 3D Physics Engines as Bullet, Newton or O.D.E. It is probably at first sight overhead... but you can use it for many great effects or add physic in your gameplay.
You can use PAL to abstract the Physics Engine.
-
\$\begingroup\$ O.D.E is the same link as bullet, but I understand the idea. \$\endgroup\$– DaveCommented Oct 23, 2010 at 21:23