private void destroyAttachedContacts() { // Delete the attached contacts. ContactEdge ce = m_contactList; while (ce != null) { ContactEdge ce0 = ce; ce = ce.next; world.getContactManager().destroy(ce0.contact); } m_contactList = null; }
private void destroyAttachedContacts() { // Delete the attached contacts. ContactEdge ce = m_contactList; while (ce != null) { ContactEdge ce0 = ce; ce = ce.next; world.getContactManager().destroy(ce0.contact); } m_contactList = null; }
void synchronizeFixtures() { final Transform xf1 = pxf; // xf1.position = m_sweep.c0 - Mul(xf1.R, m_sweep.localCenter); // xf1.q.set(m_sweep.a0); // Rot.mulToOutUnsafe(xf1.q, m_sweep.localCenter, xf1.p); // xf1.p.mulLocal(-1).addLocal(m_sweep.c0); // inlined: xf1.q.s = JBoxUtils.sin(m_sweep.a0); xf1.q.c = JBoxUtils.cos(m_sweep.a0); xf1.p.x = m_sweep.c0.x - xf1.q.c * m_sweep.localCenter.x + xf1.q.s * m_sweep.localCenter.y; xf1.p.y = m_sweep.c0.y - xf1.q.s * m_sweep.localCenter.x - xf1.q.c * m_sweep.localCenter.y; // end inline for (Fixture f : fixtures) { f.synchronize(world.getContactManager().broadPhase, xf1, m_xf); } }
void synchronizeFixtures() { final Transform xf1 = pxf; // xf1.position = m_sweep.c0 - Mul(xf1.R, m_sweep.localCenter); // xf1.q.set(m_sweep.a0); // Rot.mulToOutUnsafe(xf1.q, m_sweep.localCenter, xf1.p); // xf1.p.mulLocal(-1).addLocal(m_sweep.c0); // inlined: xf1.q.s = JBoxUtils.sin(m_sweep.a0); xf1.q.c = JBoxUtils.cos(m_sweep.a0); xf1.p.x = m_sweep.c0.x - xf1.q.c * m_sweep.localCenter.x + xf1.q.s * m_sweep.localCenter.y; xf1.p.y = m_sweep.c0.y - xf1.q.s * m_sweep.localCenter.x - xf1.q.c * m_sweep.localCenter.y; // end inline for (Fixture f : fixtures) { f.synchronize(world.getContactManager().broadPhase, xf1, m_xf); } }
BroadPhase broadPhase = world.getContactManager().broadPhase; for (Fixture f : fixtures) { f.createProxies(broadPhase, m_xf); BroadPhase broadPhase = world.getContactManager().broadPhase; for (Fixture f : fixtures) { f.destroyProxies(broadPhase);
BroadPhase broadPhase = world.getContactManager().broadPhase; for (Fixture f : fixtures) { f.createProxies(broadPhase, m_xf); BroadPhase broadPhase = world.getContactManager().broadPhase; for (Fixture f : fixtures) { f.destroyProxies(broadPhase);
private void destroyFixtures() { for (Fixture f : getFixtures()) { if (world.getDestructionListener() != null) { world.getDestructionListener().onDestroy(f); } f.destroyProxies(world.getContactManager().broadPhase); f.destroy(); // jbox2dTODO djm recycle fixtures (here or in that destroy method) } getFixtures().clear(); }
world.getContactManager().destroy(c); BroadPhase broadPhase = world.getContactManager().broadPhase; fixture.destroyProxies(broadPhase);
world.getContactManager().destroy(c); BroadPhase broadPhase = world.getContactManager().broadPhase; fixture.destroyProxies(broadPhase);
private void destroyFixtures() { for (Fixture f : getFixtures()) { if (world.getDestructionListener() != null) { world.getDestructionListener().onDestroy(f); } f.destroyProxies(world.getContactManager().broadPhase); f.destroy(); // jbox2dTODO djm recycle fixtures (here or in that destroy method) } getFixtures().clear(); }
/** * Creates a fixture and attach it to this body. * Use this function if you need to set some fixture parameters, like friction. * Otherwise you can create the fixture directly from a shape. * If the density is non-zero, this function automatically updates the mass of the body. * Contacts are not created until the next time step. * Note: This function is locked during callbacks. * * @param def the fixture definition */ public Fixture createFixture(FixtureDef def) { world.assertNotLocked(); Fixture fixture = new Fixture(this, def); if ((m_flags & e_activeFlag) == e_activeFlag) { BroadPhase broadPhase = world.getContactManager().broadPhase; fixture.createProxies(broadPhase, m_xf); } fixtures.add(fixture); // Adjust mass properties if needed. if (fixture.getDensity() > 0) { resetMassData(); } // Let the world know we have a new fixture. This will cause new contacts // to be created at the beginning of the next time step. world.notifyNewFixture(); return fixture; }
/** * Creates a fixture and attach it to this body. * Use this function if you need to set some fixture parameters, like friction. * Otherwise you can create the fixture directly from a shape. * If the density is non-zero, this function automatically updates the mass of the body. * Contacts are not created until the next time step. * Note: This function is locked during callbacks. * * @param def the fixture definition */ public Fixture createFixture(FixtureDef def) { world.assertNotLocked(); Fixture fixture = new Fixture(this, def); if ((m_flags & e_activeFlag) == e_activeFlag) { BroadPhase broadPhase = world.getContactManager().broadPhase; fixture.createProxies(broadPhase, m_xf); } fixtures.add(fixture); // Adjust mass properties if needed. if (fixture.getDensity() > 0) { resetMassData(); } // Let the world know we have a new fixture. This will cause new contacts // to be created at the beginning of the next time step. world.notifyNewFixture(); return fixture; }
/** * Set the position of the body's origin and rotation. * This breaks any contacts and wakes the other bodies. * Manipulating a body's transform may cause non-physical behavior. * Note: contacts are updated on the next call to World.step(). * * @param position the world position of the body's local origin * @param angle the world rotation in radians */ public void setTransform(Vec2 position, float angle) { world.assertNotLocked(); m_xf.q.set(angle); m_xf.p.set(position); // m_sweep.c0 = m_sweep.c = Mul(m_xf, m_sweep.localCenter); Transform.mulToOutUnsafe(m_xf, m_sweep.localCenter, m_sweep.c); m_sweep.a = angle; m_sweep.c0.set(m_sweep.c); m_sweep.a0 = m_sweep.a; BroadPhase broadPhase = world.getContactManager().broadPhase; for (Fixture f : fixtures) { f.synchronize(broadPhase, m_xf, m_xf); } }
/** * Set the position of the body's origin and rotation. * This breaks any contacts and wakes the other bodies. * Manipulating a body's transform may cause non-physical behavior. * Note: contacts are updated on the next call to World.step(). * * @param position the world position of the body's local origin * @param angle the world rotation in radians */ public void setTransform(Vec2 position, float angle) { world.assertNotLocked(); m_xf.q.set(angle); m_xf.p.set(position); // m_sweep.c0 = m_sweep.c = Mul(m_xf, m_sweep.localCenter); Transform.mulToOutUnsafe(m_xf, m_sweep.localCenter, m_sweep.c); m_sweep.a = angle; m_sweep.c0.set(m_sweep.c); m_sweep.a0 = m_sweep.a; BroadPhase broadPhase = world.getContactManager().broadPhase; for (Fixture f : fixtures) { f.synchronize(broadPhase, m_xf, m_xf); } }
/** * 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); } }
BroadPhase broadPhase = world.getContactManager().broadPhase; for (Fixture f : fixtures) { int proxyCount = f.getProxyCount();
BroadPhase broadPhase = world.getContactManager().broadPhase; for (Fixture f : fixtures) { int proxyCount = f.getProxyCount();