Exemplo n.º 1
0
  public void pushContact(Contact contact) {

    if (contact.m_manifold.pointCount > 0) {
      contact.getFixtureA().getBody().setAwake(true);
      contact.getFixtureB().getBody().setAwake(true);
    }

    ShapeType type1 = contact.getFixtureA().getType();
    ShapeType type2 = contact.getFixtureB().getType();

    IDynamicStack<Contact> creator = contactStacks[type1.ordinal()][type2.ordinal()].creator;
    creator.push(contact);
  }
Exemplo n.º 2
0
  private void addType(IDynamicStack<Contact> creator, ShapeType type1, ShapeType type2) {
    ContactRegister register = new ContactRegister();
    register.creator = creator;
    register.primary = true;
    contactStacks[type1.ordinal()][type2.ordinal()] = register;

    if (type1 != type2) {
      ContactRegister register2 = new ContactRegister();
      register2.creator = creator;
      register2.primary = false;
      contactStacks[type2.ordinal()][type1.ordinal()] = register2;
    }
  }
Exemplo n.º 3
0
  public Contact popContact(Fixture fixtureA, int indexA, Fixture fixtureB, int indexB) {
    final ShapeType type1 = fixtureA.getType();
    final ShapeType type2 = fixtureB.getType();

    final ContactRegister reg = contactStacks[type1.ordinal()][type2.ordinal()];
    final IDynamicStack<Contact> creator = reg.creator;
    if (creator != null) {
      if (reg.primary) {
        Contact c = creator.pop();
        c.init(fixtureA, indexA, fixtureB, indexB);
        return c;
      } else {
        Contact c = creator.pop();
        c.init(fixtureB, indexB, fixtureA, indexA);
        return c;
      }
    } else {
      return null;
    }
  }