Fixture fixtureB = c.getFixtureB();
Fixture fixtureB = c.getFixtureB();
/** * 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); } }
/** * 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); } }
@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); } } }
void destroy(Contact c) { Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); Body bodyA = fixtureA.getBody(); Body bodyB = fixtureB.getBody();
@Override public void beginContact(Contact contact) { Entity e1 = contact.getFixtureA().getBody().getEntity(); Entity e2 = contact.getFixtureB().getBody().getEntity(); } else if (contact.getFixtureB().isSensor()) { notifySensorCollisionBegin(e2, e1, contact.getFixtureB().getHitBox()); HitBox boxB = contact.getFixtureB().getHitBox();
void destroy(Contact c) { Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); Body bodyA = fixtureA.getBody(); Body bodyB = fixtureB.getBody();
private void pushContact(Contact contact) { Fixture fixtureA = contact.getFixtureA(); Fixture fixtureB = contact.getFixtureB(); if (contact.m_manifold.pointCount > 0 && !fixtureA.isSensor() && !fixtureB.isSensor()) { fixtureA.getBody().setAwake(true); fixtureB.getBody().setAwake(true); } ShapeType type1 = fixtureA.getType(); ShapeType type2 = fixtureB.getType(); IDynamicStack<Contact> creator = contactStacks[type1.ordinal()][type2.ordinal()].creator; creator.push(contact); } }
private void pushContact(Contact contact) { Fixture fixtureA = contact.getFixtureA(); Fixture fixtureB = contact.getFixtureB(); if (contact.m_manifold.pointCount > 0 && !fixtureA.isSensor() && !fixtureB.isSensor()) { fixtureA.getBody().setAwake(true); fixtureB.getBody().setAwake(true); } ShapeType type1 = fixtureA.getType(); ShapeType type2 = fixtureB.getType(); IDynamicStack<Contact> creator = contactStacks[type1.ordinal()][type2.ordinal()].creator; creator.push(contact); } }
@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()) { HitBox box = (HitBox) contact.getFixtureA().getUserData(); SensorCollisionHandler h = e1.getComponent(PhysicsComponent.class).getSensorHandlers().get(box); h.onCollisionEnd(e2); return; } else if (contact.getFixtureB().isSensor()) { HitBox box = (HitBox) contact.getFixtureB().getUserData(); SensorCollisionHandler h = e2.getComponent(PhysicsComponent.class).getSensorHandlers().get(box); h.onCollisionEnd(e1); 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); } } }
@Override public void beginContact(Contact contact) { Entity e1 = contact.getFixtureA().getBody().getEntity(); Entity e2 = contact.getFixtureB().getBody().getEntity(); } else if (contact.getFixtureB().isSensor()) { HitBox box = (HitBox) contact.getFixtureB().getUserData(); HitBox boxB = (HitBox)contact.getFixtureB().getUserData();
if (edge.other == bodyA) { Fixture fA = edge.contact.getFixtureA(); Fixture fB = edge.contact.getFixtureB(); int iA = edge.contact.getChildIndexA(); int iB = edge.contact.getChildIndexB(); fixtureB = c.getFixtureB(); indexA = c.getChildIndexA(); indexB = c.getChildIndexB();
if (edge.other == bodyA) { Fixture fA = edge.contact.getFixtureA(); Fixture fB = edge.contact.getFixtureB(); int iA = edge.contact.getChildIndexA(); int iB = edge.contact.getChildIndexB(); fixtureB = c.getFixtureB(); indexA = c.getChildIndexA(); indexB = c.getChildIndexB();
while (c != null) { Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); int indexA = c.getChildIndexA(); int indexB = c.getChildIndexB();
while (c != null) { Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); int indexA = c.getChildIndexA(); int indexB = c.getChildIndexB();
} else { Fixture fA = c.getFixtureA(); Fixture fB = c.getFixtureB(); Fixture fB = minContact.getFixtureB(); Body bA = fA.getBody(); Body bB = fB.getBody();
} else { Fixture fA = c.getFixtureA(); Fixture fB = c.getFixtureB(); Fixture fB = minContact.getFixtureB(); Body bA = fA.getBody(); Body bB = fB.getBody();