发现网上老多人问cocos2d粒子碰撞检测 。
很简单,如果有仔细阅读CCParticleSystemQuad.cpp 的话。可以找到一个函数。
CCParticleSystemQuad::updateQuadWithParticle( tCCParticle* particle, const CCPoint& newPosition );
这个函数是个虚函数。
我们实现他就可以从这么多粒子中取到每个粒子的位置大小信息。
知道 粒子位置 , 做碰撞检测 就很容易 了。
void TTMyParticleWeapon::updateQuadWithParticle( tCCParticle* particle, const CCPoint& newPosition )
{
CCParticleSystemQuad::updateQuadWithParticle(particle, newPosition);
if (!this->isVisible()) return ;
CCPoint pos = this->convertToWorldSpace(particle->pos);
/// 碰撞检测 。。。。。
}