# Particle collision detection and handling

## Recommended Posts

I am currently doing some sort of particle system modeling. Is there a easy way to detect collision between particles? One inefficient way I can think of it the check the new position of the particle against all other particles in the system. Problem is that I have a more than ten thousand particles in the system. Also how do you resolve such collision? I am thinking of displacing the particle that got "hit" but this may lead to a chain reaction as the new displacement might result in another collision. Hope what I said makes some sense to you guys. :) Thanks for reading.

##### Share on other sites
i have a small solution for you. say you have particles 0-9999.
compare particle0 w/ 1-9999.
compare particle1 w/ 2-9999.
and so on...
this will cut the scan time in half. somethin else to do is only check by a radius of the particle.

hope this helps and makes since lol.

##### Share on other sites
Quote:
 Original post by adam17i have a small solution for you. say you have particles 0-9999. compare particle0 w/ 1-9999.compare particle1 w/ 2-9999.and so on...this will cut the scan time in half. somethin else to do is only check by a radius of the particle.hope this helps and makes since lol.-adam

compare particle1 w/ 2-9999. = FATAL FLAW
what if particle 2 or something collides with 1? then you cant see it!

##### Share on other sites
Intamin AG: particle1 coliding with particle2 is same as particle2 coliding with particle1. No need to check both collisions.

##### Share on other sites
"cough"Whoopsie"cough"

sry lol but this happens when I dont think of that kind of things before I speak... damnit....

##### Share on other sites
perhaps partitioning the 3d space into an octree. Then, for all particles in a section of the octree... check for collisions only with other particles inside that same section. Of course there is overhead to building (once at beginning) & updating the tree (frequently), but perhaps you can take advantage of such a construct in other ways too :)

##### Share on other sites
Some time ago, I was spending some time to pre-design what my particle system should provide and what should not.
This meant I had to think at the possible uses for a particle system and their relative implementation.
Implementing per-particle collision is hard. By sure means, it's not easy to get it fast.
By the way, I realized I really would not need this, so I raccomand to understand if your engine really needs the functionality.
Now, I often over-estimate engine tasks to put some extra effort here and there, so I have to update less often.
I realized however, I could not find a single task in which per-particle collisions were needed so I dropped the functionality at all.

Consider for example, small particles such as sparks. User is not expecting two sparks to collide. If they would:
- user won't notice OR (worse)
- will notice AND will possibly think it's strange.
So collision check would fail 99.99% of the time.

Considering big particles which usually collide, I realized they are not really particles. They are usually used to represent some sort of volume of nanometric particles (such as smog). This kind of masses does not produce any visible behaviour when collision occurs.
So, while collision check would pass a lot of times, it's non-trivial to manage the collision.

I also realized that big particles which produce visible collision behaviours are really not particles, in the sense they should be really treated as standard entities because they're probably big and detailed.
So, the problem was now to realize if I really needed to manage those entities. I decided I don't, it's a way too advanced feature right now, I wasn't able to realize why one would use this. So, it has been put last on the TODO list.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628291
• Total Posts
2981862

• 11
• 10
• 10
• 11
• 17