I am using CCParticleSystemQuad to create particle effects. But I want my sprites to be able to collide with particles. Say your character is a dragon, the dragon breath is a particle effect emitting fire. When the breath hits objects (sprites), I should be able to know it collided with some sprites. How can it be done? Unfortunately google search on this subject doesn't give very good output.
|
|
Pixel perfect collision with particles would be very CPU intensive, this would be even worse on a mobile device. You may want to cheat and use a bounding shape to surround the area the particles occupy, and use that bounding shape for collision purposes. This doesn't have to be exact. It's an approximation of the area the particles occupy. I imagine if you actually implemented this and tested it you'd find that it was sufficient for your needs. |
|||||||||||
|
|
The exact answer would be a somewhat Point-In-Polygon algorithm but as mentioned above it will be very (very) time-consuming in real-time and would be more used for simulation purpose. Most of the time in real-time you can approximate this by using either :
It basically all depends of the average behavior of the shape made by all your particles. |
|||||||
|