if (c.isEnabled() == false) { 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(); minContact.update(m_contactManager.m_contactListener); minContact.m_flags &= ~Contact.TOI_FLAG; ++minContact.m_toiCount; if (minContact.isEnabled() == false || minContact.isTouching() == false) { minContact.setEnabled(false); bA.m_sweep.set(backup1); bB.m_sweep.set(backup2); contact.update(m_contactManager.m_contactListener); if (contact.isEnabled() == false) { if (contact.isTouching() == false) {
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; } } }
boolean wasTouching = (m_flags & TOUCHING_FLAG) == TOUCHING_FLAG; boolean sensorA = m_fixtureA.isSensor(); boolean sensorB = m_fixtureB.isSensor(); boolean sensor = sensorA || sensorB; Body bodyA = m_fixtureA.getBody(); Body bodyB = m_fixtureB.getBody(); Transform xfA = bodyA.getTransform(); Transform xfB = bodyB.getTransform(); evaluate(m_manifold, xfA, xfB); touching = m_manifold.pointCount > 0; bodyA.setAwake(true); bodyB.setAwake(true);
public 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); }
public WorldManifold getWorldManifold () { contact.getWorldManifold(worldManifold2); int numContactPoints = contact.getManifold().pointCount; worldManifold.numContactPoints = numContactPoints; worldManifold.normal.set(worldManifold2.normal.x, worldManifold2.normal.y); for (int i = 0; i < worldManifold.points.length; i++) { worldManifold.points[i] = new Vector2(worldManifold2.points[i].x, worldManifold2.points[i].y); } return worldManifold; }
/** * Call this if you want to establish collision that was previously disabled by * ContactFilter::ShouldCollide. */ public void refilter() { if (m_body == null) { return; } // Flag associated contacts for filtering. ContactEdge edge = m_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 = m_body.getWorld(); if (world == null) { return; } // Touch each proxy so that new pairs may be created BroadPhase broadPhase = world.m_contactManager.m_broadPhase; for (int i = 0; i < m_proxyCount; ++i) { broadPhase.touchProxy(m_proxies[i].proxyId); } }
for (Body b = m_bodyList; b != null; b = b.getNext()) { xf.set(b.getTransform()); for (Fixture f = b.getFixtureList(); f != null; f = f.getNext()) { if (b.isActive() == false) { color.set(0.5f, 0.5f, 0.3f); for (Contact c = m_contactManager.m_contactList; c != null; c = c.getNext()) { Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); fixtureA.getAABB(c.getChildIndexA()).getCenterToOut(cA); fixtureB.getAABB(c.getChildIndexB()).getCenterToOut(cB); m_debugDraw.drawSegment(cA, cB, color);
Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); int indexA = c.getChildIndexA(); int indexB = c.getChildIndexB(); Body bodyA = fixtureA.getBody(); Body bodyB = fixtureB.getBody(); if (bodyB.shouldCollide(bodyA) == false) { Contact cNuke = c; c = cNuke.getNext(); destroy(cNuke); continue; c = cNuke.getNext(); destroy(cNuke); continue; c = c.getNext(); continue; c = cNuke.getNext(); destroy(cNuke); continue; c.update(m_contactListener); c = c.getNext();
int indexB = proxyB.childIndex; Body bodyA = fixtureA.getBody(); Body bodyB = fixtureB.getBody(); ContactEdge edge = bodyB.getContactList(); 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(); if (bodyB.shouldCollide(bodyA) == false) { return; fixtureA = c.getFixtureA(); fixtureB = c.getFixtureB(); indexA = c.getChildIndexA(); indexB = c.getChildIndexB(); bodyA = fixtureA.getBody(); bodyB = fixtureB.getBody(); if (!fixtureA.isSensor() && !fixtureB.isSensor()) { bodyA.setAwake(true); bodyB.setAwake(true);
for (Body b = world.getBodyList(); b != null; b = b.getNext()) { xf.set(b.getTransform()); for (Fixture f : b.getFixtures()) { if (!b.isActive()) { color = Color.color(0.5f, 0.5f, 0.3f); for (Contact c = world.getContactManager().m_contactList; c != null; c = c.getNext()) { Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); fixtureA.getAABB(c.getChildIndexA()).getCenterToOut(cA); fixtureB.getAABB(c.getChildIndexB()).getCenterToOut(cB); debugDraw.drawSegment(cA, cB, color); for (Fixture f : b.getFixtures()) { for (int i = 0; i < f.getProxyCount(); ++i) { FixtureProxy proxy = f.m_proxies[i]; AABB aabb = world.getContactManager().m_broadPhase.getFatAABB(proxy.proxyId);
@Override public void preSolve(Contact contact, Manifold oldManifold) { super.preSolve(contact, oldManifold); Fixture fixtureA = contact.getFixtureA(); Fixture fixtureB = contact.getFixtureB(); if (fixtureA != m_platform && fixtureA != m_character) { return; } if (fixtureB != m_character && fixtureB != m_character) { return; } Vec2 position = m_character.getBody().getPosition(); if (position.y < m_top + m_radius - 3.0f * Settings.linearSlop) { contact.setEnabled(false); } } }
final Shape shapeA = fixtureA.getShape(); final Shape shapeB = fixtureB.getShape(); final float radiusA = shapeA.m_radius; final float radiusB = shapeB.m_radius; final Body bodyA = fixtureA.getBody(); final Body bodyB = fixtureB.getBody(); final Manifold manifold = contact.getManifold();
public void beginContact(Contact contact) { Fixture fixtureA = contact.getFixtureA(); Fixture fixtureB = contact.getFixtureB(); if (fixtureA == m_sensor) { Object userData = fixtureB.getBody().getUserData(); if (userData != null) { ((BoolWrapper) userData).tf = true; } } if (fixtureB == m_sensor) { Object userData = fixtureA.getBody().getUserData(); if (userData != null) { ((BoolWrapper) userData).tf = true; } } }
edge = edge.next; Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); fixture.destroyProxies(broadPhase); fixture.destroy(); fixture.m_body = null; fixture.m_next = null; resetMassData();
public void destroy(Contact c) { Fixture fixtureA = c.getFixtureA(); Fixture fixtureB = c.getFixtureB(); Body bodyA = fixtureA.getBody(); Body bodyB = fixtureB.getBody(); if (m_contactListener != null && c.isTouching()) { m_contactListener.endContact(c);
public void preSolve(Contact contact, Manifold oldManifold) { Manifold manifold = contact.getManifold(); if (manifold.pointCount == 0) { return; } Fixture fixtureA = contact.getFixtureA(); Fixture fixtureB = contact.getFixtureB(); Collision.getPointStates(state1, state2, oldManifold, manifold); contact.getWorldManifold(worldManifold); for (int i = 0; i < manifold.pointCount && pointCount < MAX_CONTACT_POINTS; i++) { ContactPoint cp = points[pointCount]; cp.fixtureA = fixtureA; cp.fixtureB = fixtureB; cp.position.set(worldManifold.points[i]); cp.normal.set(worldManifold.normal); cp.state = state2[i]; cp.normalImpulse = manifold.points[i].normalImpulse; cp.tangentImpulse = manifold.points[i].tangentImpulse; cp.separation = worldManifold.separations[i]; ++pointCount; } } }
bodyA.setAwake(true); bodyB.setAwake(true); ContactEdge edge = bodyB.getContactList(); while (edge != null) { if (edge.other == bodyA) { edge.contact.flagForFiltering();
private void performCoinCollision(boolean coinIsBodyA, Contact contact) { if (coinIsBodyA) { elementsToBeRemoved.add(contact.getFixtureA()); } else { elementsToBeRemoved.add(contact.getFixtureB()); } contact.setEnabled(false); ... } ... @Override public void onUpdate(float pSecondsElapsed) { if (elementsToBeRemoved != null) { for (Fixture fixture : elementsToBeRemoved) { fixture.setSensor(true); } } elementsToBeRemoved.clear(); }
ContactEdge edge = bodyB.getContactList(); while (edge != null) { if (edge.other == bodyA) { edge.contact.flagForFiltering();