/** * Set the contact filtering data. * This will not update contacts until the next time step when either parent body is awake. * This automatically calls refilter. * This is an expensive operation and should not be called frequently. * * @param filter filter */ public void setFilterData(final Filter filter) { this.filter.set(filter); refilter(); }
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; }
public void setAllowSleep(boolean flag) { if (flag == allowSleep) { return; } allowSleep = flag; if (!allowSleep) { for (Body b : bodies) { b.setAwake(true); } } }
/** * Destroy particles in a group without enabling the destruction callback for destroyed particles. * This function is locked during callbacks. * * @param group the particle group to destroy. */ public void destroyParticlesInGroup(ParticleGroup group) { destroyParticlesInGroup(group, false); }
/** * Registers contact listener to JBox2D world so that collisions are * registered for subsequent notification. * Only collidable entities are checked. */ private void initContactListener() { jboxWorld.setContactListener(this); }
/** * Register a contact filter to provide specific control over collision. * Otherwise the default filter is used (_defaultFilter). * The listener is owned by you and must remain in scope. * * @param filter contact filter */ public void setContactFilter(ContactFilter filter) { contactManager.setcontactFilter(filter); }
/** * Initialize the bodies, anchors, axis, and reference angle using the world anchor and world * axis. */ public void initialize(Body bA, Body bB, Vec2 anchor) { bodyA = bA; bodyB = bB; bA.getLocalPointToOut(anchor, localAnchorA); bB.getLocalPointToOut(anchor, localAnchorB); } }
private float getBodyArea() { float area = 0.0f; for (int i = 0; i < bodies.length; ++i) { final int next = (i == bodies.length - 1) ? 0 : i + 1; area += bodies[i].getWorldCenter().x * bodies[next].getWorldCenter().y - bodies[next].getWorldCenter().x * bodies[i].getWorldCenter().y; } area *= .5f; return area; }
/** * Query the world for all fixtures and particles that potentially overlap the provided AABB. * * @param callback a user implemented callback class * @param particleCallback callback for particles * @param aabb the query box */ public void queryAABB(QueryCallback callback, ParticleQueryCallback particleCallback, AABB aabb) { queryAABB(callback, aabb); queryAABB(particleCallback, aabb); }
ContactManager(IWorldPool pool, BroadPhase broadPhase) { this.pool = pool; this.broadPhase = broadPhase; initializeRegisters(); }
/** * Set the contact filtering data. * This will not update contacts until the next time step when either parent body is awake. * This automatically calls refilter. * This is an expensive operation and should not be called frequently. * * @param filter filter */ public void setFilterData(final Filter filter) { this.filter.set(filter); refilter(); }
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; }
/** * Destroy particles in a group without enabling the destruction callback for destroyed particles. * This function is locked during callbacks. * * @param group the particle group to destroy. */ public void destroyParticlesInGroup(ParticleGroup group) { destroyParticlesInGroup(group, false); }