Search in sources :

Example 1 with ShapeType

use of spacegraph.space2d.phys.collision.shapes.ShapeType in project narchy by automenta.

the class ContactManager method popContact.

public Contact popContact(Fixture fixtureA, int indexA, Fixture fixtureB, int indexB) {
    final ShapeType type1 = fixtureA.type();
    final ShapeType type2 = fixtureB.type();
    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;
    }
}
Also used : ShapeType(spacegraph.space2d.phys.collision.shapes.ShapeType) ContactRegister(spacegraph.space2d.phys.dynamics.contacts.ContactRegister) Contact(spacegraph.space2d.phys.dynamics.contacts.Contact)

Aggregations

ShapeType (spacegraph.space2d.phys.collision.shapes.ShapeType)1 Contact (spacegraph.space2d.phys.dynamics.contacts.Contact)1 ContactRegister (spacegraph.space2d.phys.dynamics.contacts.ContactRegister)1