Java 类com.badlogic.gdx.physics.box2d.Contact 实例源码

项目:homescreenarcade    文件:Field.java   
@Override public void endContact(Contact contact) {
    Fixture fixture = null;
    Ball ball = ballWithBody(contact.getFixtureA().getBody());
    if (ball != null) {
        fixture = contact.getFixtureB();
    }
    else {
        ball = ballWithBody(contact.getFixtureB().getBody());
        if (ball != null) {
            fixture = contact.getFixtureA();
        }
    }

    if (ball != null) {
        contactedBalls.add(ball);
        contactedFixtures.add(fixture);
    }
}
项目:feup-lpoo-armadillo    文件:WorldContactListener.java   
/**
 * {@inheritDoc}
 */
@Override
public void beginContact(Contact contact) {
    Fixture fixA = contact.getFixtureA();
    Fixture fixB = contact.getFixtureB();

    ContactHandler handler;
    handler = beginContactFunctions.get(fixA.getFilterData().categoryBits);
    if (handler != null)
        handler.handle(fixA, fixB);

    handler = beginContactFunctions.get(fixB.getFilterData().categoryBits);
    if (handler != null)
        handler.handle(fixB, fixA);

}
项目:feup-lpoo-armadillo    文件:WorldContactListener.java   
/**
 * {@inheritDoc}
 */
@Override
public void endContact(Contact contact) {
    Fixture fixA = contact.getFixtureA();
    Fixture fixB = contact.getFixtureB();

    ContactHandler handler;
    handler = endContactFunctions.get(fixA.getFilterData().categoryBits);
    if (handler != null)
        handler.handle(fixA, fixB);

    handler = endContactFunctions.get(fixB.getFilterData().categoryBits);
    if (handler != null)
        handler.handle(fixB, fixA);

}
项目:summer17-android    文件:WorldContactListener.java   
@Override
public void endContact(Contact contact) {

    Fixture fixA = contact.getFixtureA();
    Fixture fixB = contact.getFixtureB();
    if (fixA.getUserData() == "bottom" || fixB.getUserData() == "bottom") {
        Fixture bottom = fixA.getUserData() == "bottom" ? fixA : fixB;
        Fixture object = bottom == fixA ? fixB : fixA;

        //resets object touched
        if (object.getUserData() != null &&
                InteractiveTileObject.class.isAssignableFrom(object.getUserData().getClass())) {
            isObjectTouched = NoObjectionGame.DEFAULT;
        }
    }

}
项目:libGdx-xiyou    文件:Box2DContactListener.java   
@Override
public void endContact(Contact contact) {
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();
    // 夹具为空时,碰撞直接返回不执行。
    if (fixtureA == null || fixtureB == null) {
        return;
    }

    //孙悟空跳跃结束
    if (fixtureA.getUserData() != null && fixtureA.getUserData().equals("foot")) {
        // 计数器减1
        platformNum--;
    }
    if (fixtureB.getUserData() != null && fixtureB.getUserData().equals("foot")) {
        // 计数器减1
        platformNum--;
    }
}
项目:Undertailor    文件:CollisionHandler.java   
@Override
public void endContact(Contact contact) {
    Pair<Collider> pair = checkObjects(contact);
    if (pair != null) {
        if(pair.getA() instanceof WorldObject && pair.getB() instanceof WorldObject) {
            pair.getA().endCollision(pair.getB());
            pair.getB().endCollision(pair.getA());
        } else {
            if(pair.getA() instanceof Entrypoint) {
                pair.getA().endCollision(pair.getB());
            } else if(pair.getB() instanceof Entrypoint) {
                pair.getB().endCollision(pair.getA());;
            }
        }
    }
}
项目:Undertailor    文件:CollisionHandler.java   
@Override
public void beginContact(Contact contact) {
    Pair<Collider> pair = checkObjects(contact);
    if (pair != null) {
        if(pair.getA() instanceof WorldObject && pair.getB() instanceof WorldObject) {
            pair.getA().startCollision(pair.getB());
            pair.getB().startCollision(pair.getA());
        } else {
            if(pair.getA() instanceof Entrypoint) {
                pair.getA().startCollision(pair.getB());
            } else if(pair.getB() instanceof Entrypoint) {
                pair.getB().startCollision(pair.getA());;
            }
        }
    }
}
项目:joe    文件:Player.java   
private void handleFootContact(Contact contact, boolean onBeginContact) {
    Fixture footSensor = getFootSensor();
    if (contact.getFixtureA() == footSensor || contact.getFixtureB() == footSensor) {
        Fixture otherFixture =
                (footSensor == contact.getFixtureA()) ? contact.getFixtureB() : contact.getFixtureA();
        if (!otherFixture.isSensor()) {
            if (onBeginContact) {
                if (numFootContacts == 0) {
                    land();
                }

                numFootContacts++;
            } else {
                numFootContacts--;
            }

            numFootContacts = Math.max(0, numFootContacts);
        }
    }
}
项目:joe    文件:CollisionListener.java   
private void setEntityContact(Contact contact, Entity entityA, Entity entityB,
                              boolean beginContact) {
    if (entityA != null) {
        if (beginContact) {
            entityA.onBeginContact(contact, entityB);
        } else {
            entityA.onEndContact(contact, entityB);
        }
    }

    if (entityB != null) {
        if (beginContact) {
            entityB.onBeginContact(contact, entityA);
        } else {
            entityB.onEndContact(contact, entityA);
        }
    }
}
项目:libgdxjam    文件:PlayerBulletContactListener.java   
@Override
public void beginContact(Contact contact) {
    Entity entity = getEntity(contact, PlayerComponent.class);

    spawnSmoke(entity);
    laserHit.play();
    engine.removeEntity(entity);
    Timer.instance().scheduleTask(
        new Task() {
            @Override
            public void run() {
                EventManager.fireEvent(
                    SceneManager.getCurrentScene(),
                    new Event(EventType.YOU_HAVE_BEEN_KILLED, false, false)
                );
            }
        },
        2.0f
    );
}
项目:libgdxjam    文件:SensorSystem.java   
@Override
public void beginContact(Contact contact) // TODO: NOT SURE BUT... I THINK SAME ENTITY IS PROCESSED AT LEAST TWICE
{
    for (Entity entity : getEntities())
    {
        SensorComponent sensor = Mappers.sensor.get(entity);

        if (!matches(contact, sensor.sensorFixture)) { continue; }

        if(sensor.isBoxSensible &&
                !sensor.isCollidingPlayer &&
                sensor.sensorReactionEnter != null)
        {
            sensor.sensorReactionEnter.run();
        }
        sensor.isCollidingBox = true;
    }
}
项目:libgdxjam    文件:SensorSystem.java   
@Override
public void endContact(Contact contact) 
{
    for (Entity entity : getEntities())
    {
        SensorComponent sensor = Mappers.sensor.get(entity);

        if (!matches(contact, sensor.sensorFixture)) { continue; }

        if(sensor.isBoxSensible && 
                !sensor.isCollidingPlayer &&
                sensor.sensorReactionEnter != null)
        {
            sensor.sensorReactionExit.run();
        }
        sensor.isCollidingBox = false;
    }
}
项目:libgdxjam    文件:SensorSystem.java   
@Override
public void beginContact(Contact contact) // TODO: NOT SURE BUT... I THINK SAME ENTITY IS PROCESSED AT LEAST TWICE
{
    for (Entity entity : getEntities())
    {
        SensorComponent sensor = Mappers.sensor.get(entity);

        if (!matches(contact, sensor.sensorFixture)) { continue; }

        if(sensor.isPlayerSensible && 
                !sensor.isCollidingBox && 
                sensor.sensorReactionEnter != null)
        {
            sensor.sensorReactionEnter.run();
        }
        sensor.isCollidingPlayer = true;
    }
}
项目:libgdxjam    文件:SensorSystem.java   
@Override
public void endContact(Contact contact) // TODO: NOT SURE BUT... I THINK SAME ENTITY IS PROCESSED AT LEAST TWICE
{
    for (Entity entity : getEntities())
    {
        SensorComponent sensor = Mappers.sensor.get(entity);

        if (!matches(contact, sensor.sensorFixture)) { continue; }

        if(sensor.isPlayerSensible && 
                !sensor.isCollidingBox && 
                sensor.sensorReactionEnter != null)
        {
            sensor.sensorReactionExit.run();
        }
        sensor.isCollidingPlayer = false;
    }
}
项目:Dodgy-Dot    文件:GameScreen.java   
@Override
public void beginContact(Contact contact) {
    // TODO Auto-generated method stub
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();

    //logger.info("contact");
    if (state == GAME_RUNNING) {
        if (fixtureA.getFilterData().categoryBits == CATEGORY_PLAYER &&
                fixtureB.getFilterData().categoryBits == CATEGORY_ENEMY) {
            //fixtureA.getFilterData().maskBits = 0;
            state = GAME_OVER_SETUP;
        }

        else if (fixtureA.getFilterData().categoryBits == CATEGORY_ENEMY &&
                fixtureB.getFilterData().categoryBits == CATEGORY_PLAYER) {
            //fixtureB.getFilterData().maskBits = 0;
            state = GAME_OVER_SETUP;
        }
    }

    if ((fixtureA.isSensor() == true && fixtureB.getFilterData().categoryBits == CATEGORY_PLAYER)
            || (fixtureB.isSensor() == true && fixtureA.getFilterData().categoryBits == CATEGORY_PLAYER)) {
        state = BALL_DESTROYED;
    }
}
项目:Vector-Pinball-Editor    文件:Field.java   
@Override public void endContact(Contact contact) {
    Fixture fixture = null;
    Ball ball = ballWithBody(contact.getFixtureA().getBody());
    if (ball != null) {
        fixture = contact.getFixtureB();
    }
    else {
        ball = ballWithBody(contact.getFixtureB().getBody());
        if (ball != null) {
            fixture = contact.getFixtureA();
        }
    }

    if (ball != null) {
        contactedBalls.add(ball);
        contactedFixtures.add(fixture);
    }
}
项目:jumpdontdie    文件:Box2DScreen.java   
@Override
public void endContact(Contact contact) {
    // End the collision.
    Fixture fixtureA = contact.getFixtureA(), fixtureB = contact.getFixtureB();

    // This is another way for guessing which fixture are you working with. If you have
    // the reference to that fixture you can just check if both variable reference the
    // same instance.
    if (fixtureA == minijoeFixture && fixtureB == floorFixture) {
        isJumping = true;
    }

    if (fixtureA == floorFixture && fixtureB == minijoeFixture) {
        isJumping = true;
    }
}
项目:METEORIC    文件:ContactEntities.java   
public void beginContact(Contact contact) {
    if(contact.getFixtureA().getBody().getPosition().x * GameMain.PIXELS_TO_METERS < GameMain.WIDTH / 2){
        screen.forceToZero(-1);
    }else{
        screen.forceToZero(1);
    }

    Short a = contact.getFixtureA().getFilterData().categoryBits;
    Short b = contact.getFixtureB().getFilterData().categoryBits;

    if (a.equals(GameMain.METEOR_ENTITY) && b.equals(GameMain.OBSTACLE_ENTITY) ||
            b.equals(GameMain.METEOR_ENTITY) && a.equals(GameMain.OBSTACLE_ENTITY)){

        screen.endGame();
        sound.play();
    }
}
项目:QuackHack    文件:WorldContactListener.java   
@Override
public void beginContact(Contact contact) {
    Fixture fixA = contact.getFixtureA();
    Fixture fixB = contact.getFixtureB();

    if (fixA.getUserData() instanceof Player || fixB.getUserData() instanceof Player) {
        Fixture objA = fixA.getUserData() instanceof Player ? fixA : fixB;
           ((Player) objA.getUserData()).setTouching(true);
           collision.play();
    }
}
项目:QuackHack    文件:WorldContactListener.java   
@Override
public void endContact(Contact contact) {
    Fixture fixA = contact.getFixtureA();
    Fixture fixB = contact.getFixtureB();

       if (fixA.getUserData() instanceof Player || fixB.getUserData() instanceof Player) {
           Fixture objA = fixA.getUserData() instanceof Player ? fixA : fixB;
           ((Player) objA.getUserData()).setTouching(false);
       }

}
项目:gdxjam-ugg    文件:PhysicsContactListener.java   
@Override
public void endContact (Contact contact) {
    GameEntity entityA = (GameEntity)contact.getFixtureA().getBody().getUserData();
    GameEntity entityB = (GameEntity)contact.getFixtureB().getBody().getUserData();

    entityA.removeCollision(entityB);
    entityB.removeCollision(entityA);

    /*if (Components.SQUAD.has(entityA)) processTargetTracker(entityA, entityB, true);
    if (Components.SQUAD.has(entityB)) processTargetTracker(entityB, entityA, true);*/
}
项目:cgc-game    文件:ContactManager.java   
public void beginContact(Contact contact) 
{
    if (contact == null || contact.getFixtureA() == null || contact.getFixtureB() == null ||
            contact.getFixtureA().getBody() == null || contact.getFixtureB().getBody() == null ||
            (GameEntity)contact.getFixtureA().getBody().getUserData() == null || 
            (GameEntity)contact.getFixtureB().getBody().getUserData() == null)
    {
        return;
    }

    Fixture fA = contact.getFixtureA();
    Fixture fB = contact.getFixtureB();
    Body a = contact.getFixtureA().getBody();
    Body b = contact.getFixtureB().getBody();
    GameEntity geA = (GameEntity)a.getUserData();
    GameEntity geB = (GameEntity)b.getUserData();

    if (geA.getType() == EntityType.CHAINLINK && geB.getType() == EntityType.CHAINLINK)
    {
        return;
    }

    geA.collide(geB);

    testPlayerCoin(geA, geB, true);
    testPlayerSensor(geA, geB, true);
    testPlayerMud(geA, geB, fA, fB, true);
    testPlayerWater(geA, geB, fA, fB, true);
    testPlayerTower(geA, geB, fA, fB, true);

    testPlayerChair(geA, geB, true);

    testPlayerBridge(geA, geB, fA, fB, true);
    testPlayerSpotlight(geA, geB, fA, fB, true);
    testCarrierCopChainLink(geA, geB, true);

    testSteelHorseWall(geA, geB, true);
}
项目:cgc-game    文件:ContactManager.java   
public void endContact(Contact contact)
{
    if (contact == null || contact.getFixtureA() == null || contact.getFixtureB() == null ||
            contact.getFixtureA().getBody() == null || contact.getFixtureB().getBody() == null ||
            (GameEntity)contact.getFixtureA().getBody().getUserData() == null ||
            (GameEntity)contact.getFixtureB().getBody().getUserData() == null)
    {
        return;
    }


    Fixture fA = contact.getFixtureA();
    Fixture fB = contact.getFixtureB();
    Body a = contact.getFixtureA().getBody();
    Body b = contact.getFixtureB().getBody();
    GameEntity geA = (GameEntity)a.getUserData();
    GameEntity geB = (GameEntity)b.getUserData();

    testPlayerCoin(geA, geB, false);
    testPlayerSensor(geA, geB, false);
    testPlayerMud(geA, geB, fA, fB, false);
    testPlayerWater(geA, geB, fA, fB, false);
    testPlayerTower(geA, geB, fA, fB, false);

    testPlayerChair(geA, geB, false);

    testPlayerBridge(geA, geB, fA, fB, false);
    testPlayerSpotlight(geA, geB, fA, fB, false);
    testCarrierCopChainLink(geA, geB, false);

    testSteelHorseWall(geA, geB, false);
}
项目:cgc-game    文件:ContactManager.java   
public void preSolve(Contact contact, Manifold oldManifold) 
{
    Object goA = contact.getFixtureA().getBody().getUserData();
    Object goB = contact.getFixtureB().getBody().getUserData();

    Player p = null;
    PlayerWall pw = null;
    if(goA instanceof Player && goB instanceof PlayerWall)
    {
        p = (Player)goA;
        pw = (PlayerWall)goB;
    }
    else if(goA instanceof PlayerWall && goB instanceof Player)
    {
        p = (Player)goB;
        pw = (PlayerWall)goA;
    }

    if(pw != null && p != null)
    {
        if((pw.isTop() && p.getBody().getWorldCenter().cpy().y >= pw.getBody().getWorldCenter().y) || (!pw.isTop() && p.getBody().getWorldCenter().cpy().y <= pw.getBody().getWorldCenter().y))
        {
            contact.setEnabled(false);
        }
        return;
    }   
}
项目:rebel-invader    文件:PhysicsListener.java   
/**
 * Called every time step while the fixtures are overlapping
 * Gives you a chance to find out what impulses were caused by the collision response after it has been applied
 *
 * @param contact
 * @param impulse
 */
@Override
public void postSolve(Contact contact, ContactImpulse impulse) {
    //Gdx.app.log(this.getClass().getSimpleName(), "postSolve() called");

    Body a = contact.getFixtureA().getBody();
    Body b = contact.getFixtureB().getBody();

    // If a is a player
    if (a.getUserData().getClass() == PlayerSystem.class) {
        // If b is a structure
        if (b.getUserData().getClass() == StructureSystem.class) {
            a.setUserData(BodyComponent.PLAYER_STRUCTURE_COLLISION);
        }
        // If b is an enemy
        if (b.getUserData().getClass() == EnemySystem.class) {
            a.setUserData(BodyComponent.PLAYER_ENEMY_COLLISION);
        }
    }

    // If b is a player
    if (b.getUserData().getClass() == PlayerSystem.class) {
        // If a is a structure
        if (a.getUserData().getClass() == StructureSystem.class) {
            b.setUserData(BodyComponent.PLAYER_STRUCTURE_COLLISION);
        }
        // If a is an enemy
        if (a.getUserData().getClass() == EnemySystem.class) {
            b.setUserData(BodyComponent.PLAYER_ENEMY_COLLISION);
        }
    }
}
项目:Undertailor    文件:CollisionHandler.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    Pair<Collider> pair = checkObjects(contact);
    if (pair != null) {
        if (!pair.getA().canCollide() || !pair.getB().canCollide()
            || (pair.getA().getGroupId() >= 0 && pair.getA().getGroupId() == pair.getB().getGroupId())) {
            contact.setEnabled(false);
        }
    }
}
项目:Undertailor    文件:CollisionHandler.java   
/**
 * Internal method.
 * 
 * <p>Quick check method to ensure eligibility for
 * intereference by this {@link CollisionHandler}.</p>
 */
private static Pair<Collider> checkObjects(Contact contact) {
    Object a = contact.getFixtureA().getBody().getUserData();
    Object b = contact.getFixtureB().getBody().getUserData();
    if (a instanceof Collider && b instanceof Collider) {
        CollisionHandler.RETURN_PAIR.setItems((Collider) a, (Collider) b);
        return CollisionHandler.RETURN_PAIR;
    }

    return null;
}
项目:joe    文件:DeadlyPlatform.java   
@Override
public void onBeginContact(Contact contact, Entity entity) {
    if (Entity.isPlayer(entity)) {
        isPlayerTouching = true;
        ((AnimatedSprite)sprite).play();
    }
}
项目:joe    文件:Player.java   
@Override
public void onBeginContact(Contact contact, Entity entity) {
    handleFootContact(contact, true);

    if (entity instanceof GroovySpinningThingy) {
        setDone();
    }
}
项目:joe    文件:GroovySpinningThingy.java   
@Override
public void onBeginContact(Contact contact, Entity entity) {
    if (!obtained && Entity.isPlayer(entity)) {
        obtained = true;

        setDone();
        beginParticleEffect();

        Globals.setGameState(Game.State.LEVEL_COMPLETE);
    }
}
项目:M-M    文件:ContactService.java   
@Override
public void beginContact(final Contact contact) {
    final Object userDataA = contact.getFixtureA().getUserData();
    final Object userDataB = contact.getFixtureB().getUserData();
    if (userDataA != null && userDataB != null) {
        preCollide((Entity) userDataA, (Entity) userDataB);
    }
}
项目:M-M    文件:ContactService.java   
@Override
public void endContact(final Contact contact) {
    final Object userDataA = contact.getFixtureA().getUserData();
    final Object userDataB = contact.getFixtureB().getUserData();
    if (userDataA != null && userDataB != null) {
        postCollide((Entity) userDataA, (Entity) userDataB);
    }
}
项目:advio    文件:ContactListener.java   
@Override
public void beginContact(Contact contact) {
    final Fixture a = contact.getFixtureA();
    final Fixture b = contact.getFixtureB();
    if (a == null || b == null)
        return;
    if ((a.getUserData().equals("food") && b.getUserData().equals("player"))) {
        playerHitsFood(b, a);
    } else if ((b.getUserData().equals("food") && a.getUserData().equals("player"))) {
        playerHitsFood(a, b);
    } else if ((b.getUserData().equals("food") && a.getUserData().equals("block"))) {
        foodHitsBlock(b, a);
    } else if ((a.getUserData().equals("food") && b.getUserData().equals("block"))) {
        foodHitsBlock(a, b);
    } else if ((a.getUserData().equals("player") && b.getUserData().equals("enemy"))) {
        playerHitsEnemy(a, b);
    } else if ((a.getUserData().equals("player") && b.getUserData().equals("plate"))) {
        playerHitsPlate(a, b);
    } else if ((b.getUserData().equals("player") && a.getUserData().equals("plate"))) {
        playerHitsPlate(b, a);
    } else if ((b.getUserData().equals("player") && a.getUserData().equals("goal"))) {
        playerHitsGoal(b, a);
    } else if ((b.getUserData().equals("player") && a.getUserData().equals("agariologic"))) {
        playerHitsAgarLogic(b, a);
    } else if ((a.getUserData().equals("food") && b.getUserData().equals("enemy"))) {
        foodHitsEnemy(a, b);
    } else if ((b.getUserData().equals("food") && a.getUserData().equals("enemy"))) {
        foodHitsEnemy(b, a);
    }
}
项目:RavTech    文件:Rigidbody.java   
public void onCollisionEnter (final Fixture other, final Contact contact) {
    Gdx.app.postRunnable(new Runnable() {
        @Override
        public void run () {
            if (getParent().getComponentByType(ComponentType.ScriptComponent) != null)
                ((ScriptComponent)getParent().getComponentByType(ComponentType.ScriptComponent)).callFunction("onCollisionEnter",
                    new Object[] {other, contact});
        }
    });
}
项目:RavTech    文件:Rigidbody.java   
public void onCollisionExit (final Fixture other, final Contact contact) {
    Gdx.app.postRunnable(new Runnable() {
        @Override
        public void run () {
            if (getParent().getComponentByType(ComponentType.ScriptComponent) != null)
                ((ScriptComponent)getParent().getComponentByType(ComponentType.ScriptComponent)).callFunction("onCollisionExit",
                    new Object[] {other, contact});
        }
    });
}
项目:libgdxjam    文件:PlayerLevelContactListener.java   
@Override
public void beginContact(Contact contact) {
    PlayerComponent player = getPlayer(contact);

    if (!matches(contact, player.feetSensor)) { return; }

    player.feetContacts++;
    player.grounded = player.feetContacts > 0;
    player.fixture.setFriction(player.groundFriction);

    if (player.feetContacts == 1) {
        logger.info("landed");
        footsteps.play();
    }
}
项目:libgdxjam    文件:PlayerLevelContactListener.java   
@Override
public void endContact(Contact contact) {
    PlayerComponent player = getPlayer(contact);

    if (!matches(contact, player.feetSensor)) { return; }

    player.feetContacts = Math.max(0, player.feetContacts - 1);
    player.grounded = player.feetContacts > 0;

    if (!player.grounded) {
        player.fixture.setFriction(0.0f);
    }
}
项目:libgdxjam    文件:PlayerLevelContactListener.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    PlayerComponent player = getPlayer(contact);

    if (!matches(contact, player.fixture)) { return; }

    if (player.grounded && contact.isTouching()) {
        contact.resetFriction();
    }
}
项目:libgdxjam    文件:CollisionHandler.java   
@Override
public void beginContact(Contact contact) {
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();

    ContactListener listener = get(
        fixtureA.getFilterData().categoryBits,
        fixtureB.getFilterData().categoryBits
    );

    if (listener != null) {
        listener.beginContact(contact);
    }
}
项目:libgdxjam    文件:CollisionHandler.java   
@Override
public void endContact(Contact contact) {
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();

    ContactListener listener = get(
        fixtureA.getFilterData().categoryBits,
        fixtureB.getFilterData().categoryBits
    );

    if (listener != null) {
        listener.endContact(contact);
    }
}