/** * Call this if you want to establish collision that was previously disabled by * ContactFilter::ShouldCollide. */ public void refilter() { // Flag associated contacts for filtering. ContactEdge edge = body.getContactList(); while (edge != null) { Contact contact = edge.contact; Fixture fixtureA = contact.getFixtureA(); Fixture fixtureB = contact.getFixtureB(); if (fixtureA == this || fixtureB == this) { contact.flagForFiltering(); } edge = edge.next; } World world = body.getWorld(); if (world == null) { return; } // Touch each proxy so that new pairs may be created BroadPhase broadPhase = world.getContactManager().broadPhase; for (int i = 0; i < proxyCount; ++i) { broadPhase.touchProxy(proxies[i].proxyId); } }
Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); int indexA = c.getChildIndexA(); int indexB = c.getChildIndexB(); Body bodyA = fixtureA.getBody(); Body bodyB = fixtureB.getBody(); c = cNuke.getNext(); destroy(cNuke); continue; c = cNuke.getNext(); destroy(cNuke); continue; c = c.getNext(); continue; c = cNuke.getNext(); destroy(cNuke); continue; c.update(contactListener); c = c.getNext();
public void storeImpulses() { for (int i = 0; i < m_count; i++) { final ContactVelocityConstraint vc = m_velocityConstraints[i]; final Manifold manifold = m_contacts[vc.contactIndex].getManifold(); for (int j = 0; j < vc.pointCount; j++) { manifold.points[j].normalImpulse = vc.points[j].normalImpulse; manifold.points[j].tangentImpulse = vc.points[j].tangentImpulse; } } }
void destroy(Contact c) { Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); Body bodyA = fixtureA.getBody(); Body bodyB = fixtureB.getBody(); if (contactListener != null && c.isTouching()) { contactListener.endContact(c);
if (!c.isEnabled()) { continue; Fixture fA = c.getFixtureA(); Fixture fB = c.getFixtureB(); int indexA = c.getChildIndexA(); int indexB = c.getChildIndexB(); Fixture fA = minContact.getFixtureA(); Fixture fB = minContact.getFixtureB(); Body bA = fA.getBody(); Body bB = fB.getBody(); minContact.update(contactManager.getContactListener()); minContact.m_flags &= ~Contact.TOI_FLAG; ++minContact.m_toiCount; if (!minContact.isEnabled() || !minContact.isTouching()) { minContact.setEnabled(false); bA.m_sweep.set(backup1); bB.m_sweep.set(backup2); contact.update(contactManager.getContactListener()); if (!contact.isEnabled()) { other.m_sweep.set(backup1); other.synchronizeTransform();
@Override public void endContact(Contact contact) { Entity e1 = contact.getFixtureA().getBody().getEntity(); Entity e2 = contact.getFixtureB().getBody().getEntity(); // check sensors first if (contact.getFixtureA().isSensor()) { notifySensorCollisionEnd(e1, e2, contact.getFixtureA().getHitBox()); return; } else if (contact.getFixtureB().isSensor()) { notifySensorCollisionEnd(e2, e1, contact.getFixtureB().getHitBox()); return; } if (!areCollidable(e1, e2)) return; CollisionHandler handler = getHandler(e1, e2); if (handler != null) { int pairIndex = getPairIndex(e1, e2); // collision registered, so remove it and put pair back to pool if (pairIndex != -1) { CollisionPair pair = collisions.get(pairIndex); collisions.removeIndex(pairIndex); pair.collisionEnd(); Pools.free(pair); } } }
while (edge != null) { if (edge.other == bodyA) { Fixture fA = edge.contact.getFixtureA(); Fixture fB = edge.contact.getFixtureB(); int iA = edge.contact.getChildIndexA(); int iB = edge.contact.getChildIndexB(); fixtureA = c.getFixtureA(); fixtureB = c.getFixtureB(); indexA = c.getChildIndexA(); indexB = c.getChildIndexB(); bodyA = fixtureA.getBody(); bodyB = fixtureB.getBody();
@Override public void init(Fixture fA, int indexA, Fixture fB, int indexB) { super.init(fA, indexA, fB, indexB); assert (m_fixtureA.getType() == ShapeType.CHAIN); assert (m_fixtureB.getType() == ShapeType.POLYGON); }
if (!contact.isEnabled() || !contact.isTouching()) { continue;
if (edge.other == bodyA) { edge.contact.flagForFiltering();
evaluate(m_manifold, xfA, xfB); touching = m_manifold.pointCount > 0;
if (!c.isEnabled()) { continue; Fixture fA = c.getFixtureA(); Fixture fB = c.getFixtureB(); int indexA = c.getChildIndexA(); int indexB = c.getChildIndexB(); Fixture fA = minContact.getFixtureA(); Fixture fB = minContact.getFixtureB(); Body bA = fA.getBody(); Body bB = fB.getBody(); minContact.update(contactManager.getContactListener()); minContact.m_flags &= ~Contact.TOI_FLAG; ++minContact.m_toiCount; if (!minContact.isEnabled() || !minContact.isTouching()) { minContact.setEnabled(false); bA.m_sweep.set(backup1); bB.m_sweep.set(backup2); contact.update(contactManager.getContactListener()); if (!contact.isEnabled()) { other.m_sweep.set(backup1); other.synchronizeTransform();
@Override public void beginContact(Contact contact) { Entity e1 = contact.getFixtureA().getBody().getEntity(); Entity e2 = contact.getFixtureB().getBody().getEntity(); if (contact.getFixtureA().isSensor()) { notifySensorCollisionBegin(e1, e2, contact.getFixtureA().getHitBox()); } else if (contact.getFixtureB().isSensor()) { notifySensorCollisionBegin(e2, e1, contact.getFixtureB().getHitBox()); HitBox boxA = contact.getFixtureA().getHitBox(); HitBox boxB = contact.getFixtureB().getHitBox();
while (edge != null) { if (edge.other == bodyA) { Fixture fA = edge.contact.getFixtureA(); Fixture fB = edge.contact.getFixtureB(); int iA = edge.contact.getChildIndexA(); int iB = edge.contact.getChildIndexB(); fixtureA = c.getFixtureA(); fixtureB = c.getFixtureB(); indexA = c.getChildIndexA(); indexB = c.getChildIndexB(); bodyA = fixtureA.getBody(); bodyB = fixtureB.getBody();
void destroy(Contact c) { Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); Body bodyA = fixtureA.getBody(); Body bodyB = fixtureB.getBody(); if (contactListener != null && c.isTouching()) { contactListener.endContact(c);
@Override public void init(Fixture fA, int indexA, Fixture fB, int indexB) { super.init(fA, indexA, fB, indexB); assert (m_fixtureA.getType() == ShapeType.EDGE); assert (m_fixtureB.getType() == ShapeType.CIRCLE); }
if (!contact.isEnabled() || !contact.isTouching()) { continue;
if (edge.other == bodyA) { edge.contact.flagForFiltering();
evaluate(m_manifold, xfA, xfB); touching = m_manifold.pointCount > 0;
Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); int indexA = c.getChildIndexA(); int indexB = c.getChildIndexB(); Body bodyA = fixtureA.getBody(); Body bodyB = fixtureB.getBody(); c = cNuke.getNext(); destroy(cNuke); continue; c = cNuke.getNext(); destroy(cNuke); continue; c = c.getNext(); continue; c = cNuke.getNext(); destroy(cNuke); continue; c.update(contactListener); c = c.getNext();