use of org.jbox2d.dynamics.contacts.ContactRegister in project libgdx by libgdx.
the class WorldRayCastWrapper method addType.
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;
}
}
use of org.jbox2d.dynamics.contacts.ContactRegister in project libgdx by libgdx.
the class WorldRayCastWrapper method popContact.
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()];
if (reg != null) {
if (reg.primary) {
Contact c = reg.creator.pop();
c.init(fixtureA, indexA, fixtureB, indexB);
return c;
} else {
Contact c = reg.creator.pop();
c.init(fixtureB, indexB, fixtureA, indexA);
return c;
}
} else {
return null;
}
}
Aggregations