google / liquidfun

2D physics engine for games

Home Page:http://google.github.io/liquidfun

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serious Bug about particle collision

panxiaohai opened this issue · comments

  1. Some times in special coordinate (example when x between 325.19 and 330.3309) , particle not collide with any fixtures;
  2. Please add origin shift to particle system.

The problem maybe in here :
b2FixtureParticleQueryCallback::ReportFixture

// Receive a fixture and call ReportFixtureAndParticle() for each particle
// inside aabb of the fixture.
bool ReportFixture(b2Fixture* fixture)
{
    if (fixture->IsSensor())
    {
        return true;
    }
    const b2Shape* shape = fixture->GetShape();
    int32 childCount = shape->GetChildCount();
    for (int32 childIndex = 0; childIndex < childCount; childIndex++)
    {
        b2AABB aabb = fixture->GetAABB(childIndex);
        b2ParticleSystem::InsideBoundsEnumerator enumerator =
                            m_system->GetInsideBoundsEnumerator(aabb);
        int32 index;
        //////////////////////////////////////////////////////////////////////////////////////////
        **// bus in here:  the enumerator always have zero item**
        while ((index = enumerator.GetNext()) >= 0)  
        {
            ReportFixtureAndParticle(fixture, childIndex, index);
        }
    }
    return true;
}