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

项目:jumplings    文件:JumplingActor.java   
@Override
public final void onPreSolveContact(Body bodyA, Box2DActor<T> actorB, Body bodyB, Contact contact, Manifold oldManifold) {

    if (actorB instanceof WallActor) {
        WallActor wall = (WallActor) actorB;
        if (!mEntered) {
            // est� entrando se le deja pasar
            contact.setEnabled(false);
        } else if (wall.floor) {
            // se va a escapar!
            float v = bodyA.getLinearVelocity().y;
            // si va muy r�pido hacia abajo se perdona al jugador y se deja
            // que rebote
            if (v > BOUNCING_VEL) {
                // se deja que se escape
                contact.setEnabled(false);
            }
        }

    }

}
项目:the-erder    文件:CollisionListener.java   
@Override
public void preSolve(Contact arg0, Manifold arg1)
{
    final PhysicalData pData1 = (PhysicalData) ((IPhysic)arg0.getFixtureA()
            .getUserData()).getData();
    final PhysicalData pData2 = (PhysicalData) ((IPhysic)arg0.getFixtureB()
            .getUserData()).getData();
    if (!pData1.getIgnore() && !pData2.getIgnore()  && pData1.getZ() != pData2.getZ()){
        arg0.setEnabled(false);
    }
      else
      {
       final IPhysic p1 = (IPhysic)arg0.getFixtureA()
                .getUserData();
        final IPhysic p2 = (IPhysic)arg0.getFixtureB()
                .getUserData();
        if(p1.getType() != TypeId.getTypeId(Type.Entity) && p2.getType() != TypeId.getTypeId(Type.Entity))
        BattleSystem.CheckForBattle(p1.getType(), p1.getId(), p2.getType(), p2.getId());
    }
}
项目:Blob-Game    文件:BlobDetangler.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();
    Body bodyA = fixtureA.getBody();
    Body bodyB = fixtureB.getBody();
    Actor actorA = (Actor) bodyA.getUserData();
    Actor actorB = (Actor) bodyB.getUserData();
    if (actorA != null && actorB != null && actorA instanceof Blob && actorB instanceof Blob) {
        ArrayList<Blob> blobsA = (ArrayList<Blob>) fixtureA.getUserData();
        ArrayList<Blob> blobsB = (ArrayList<Blob>) fixtureB.getUserData();
        Blob blobA = ((Blob) actorA);
        Blob blobB = ((Blob) actorB);
        if ((blobsA.contains(actorB) || blobA.isSolid())
                && (blobsB.contains(actorA) || blobB.isSolid())
                && !(blobB.isSolid() && blobA.isSolid())) {
            contact.setEnabled(false);
        }
    }
}
项目:flixel-gdx-box2d    文件:TestBreakable.java   
@Override
public void onContact(B2FlxShape sprite1, B2FlxShape sprite2, Contact contact, Manifold oldManifold, ContactImpulse impulse)
{
    if(_broke)
    {
        // The body already broke.
        return;
    }

    // Should the body break?
    int count = contact.getWorldManifold().getNumberOfContactPoints();

    float maxImpulse = 0.0f;
    for(int i = 0; i < count; i++)
    {
        maxImpulse = B2FlxMath.max(maxImpulse, impulse.getNormalImpulses()[i]);
    }

    if(maxImpulse > 40.0f)
    {
        _break = true;
    }
}
项目: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;
    }   
}
项目: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);
        }
    }
}
项目: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 preSolve(Contact contact, Manifold oldManifold) {
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();

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

    if (listener != null) {
        listener.preSolve(contact, oldManifold);
    }
}
项目:sioncore    文件:CollisionHandler.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();

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

    if (listener != null) {
        listener.preSolve(contact, oldManifold);
    }
}
项目:CodeBase    文件:PhysixComponentAwareContactListener.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    if (contact.getFixtureA() != null && contact.getFixtureB() != null) {
        for (ComponentContactListener listener : listenerMap.values()) {
            listener.preSolve(contact, oldManifold);
        }
    }
}
项目:libgdxcn    文件:ConveyorBelt.java   
public void preSolve (Contact contact, Manifold oldManifold) {
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();

    if (fixtureA == m_platform || fixtureB == m_platform) {
        contact.setTangentSpeed(5.0f);
    }
}
项目:flixel-gdx-box2d    文件:TestCollisionDetection.java   
@Override
public void onContact(B2FlxShape sprite1, B2FlxShape sprite2, Contact contact, Manifold oldManifold, ContactImpulse impulse)
{
    _ghost2.removeOverlap();
    if(!_ghost2.gotOverlaps())
        _ghost2.setAlpha(1f);
}
项目:flixel-gdx-box2d    文件:B2FlxContactListener.java   
/**
 * This is called after a contact is updated. This allows you to inspect a contact before it goes to the solver. If you are
 * careful, you can modify the contact manifold (e.g. disable contact). A copy of the old manifold is provided so that you can
 * detect changes. Note: this is called only for awake bodies. Note: this is called even when the number of contact points is
 * zero. Note: this is not called for sensors. Note: if you set the number of contact points to zero, you will not get an
 * EndContact callback. However, you may get a BeginContact callback the next step.
 */
@Override
public void preSolve(Contact contact, Manifold oldManifold)
{
    if(_event == null)
        return;
    _event.impulse = null;
    _event.oldManifold = oldManifold;
    dispatch(contact, B2FlxContactEvent.PRE_SOLVE);
}
项目:DreamsLibGdx    文件:WorldController.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    contact.resetFriction();
    AbstractWorldManager managerA=getManager(((Box2DPhysicsObject) contact.getFixtureA().getUserData()).getGrupo());
    AbstractWorldManager managerB=getManager(((Box2DPhysicsObject) contact.getFixtureB().getUserData()).getGrupo());

    if(managerA!=null) managerA.handlePreSolve(contact, oldManifold);
    if(managerB!=null) managerB.handlePreSolve(contact, oldManifold);
}
项目:JavaLib    文件:ContactManager.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    Fixture f1 = contact.getFixtureA();
    Fixture f2 = contact.getFixtureB();

    final Entity e1 = (Entity) f1.getBody().getUserData();
    final Entity e2 = (Entity) f2.getBody().getUserData();

    if (e1 == null || e2 == null)
        return; // If the collision is invalid

    // PHYSICAL CODE
    if (!f1.isSensor() && !f2.isSensor()) { // They are both physical

        if (e1.hasComponent(Collidable.class) && e2.hasComponent(Collidable.class)) {

            final Collidable c1 = (Collidable) e1
                    .getComponent(Collidable.class);
            final Collidable c2 = (Collidable) e2
                    .getComponent(Collidable.class);

            float collide1 = c1.continueCollision(e1, e2);
            float collide2 = c2.continueCollision(e2, e1);

            if (collide1 == 0f || collide2 == 0f) {
                contact.setEnabled(false);
            }
        }

    }
}
项目:homescreenarcade    文件:Field.java   
@Override public void preSolve(Contact arg0, Manifold arg1) {
    // Not used.
}
项目:feup-lpoo-armadillo    文件:WorldContactListener.java   
/**
 * {@inheritDoc}
 */
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
}
项目:GDX-Engine    文件:CustomContact.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    // TODO Auto-generated method stub

}
项目:water2d-libgdx    文件:MyContactListener.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    // TODO Auto-generated method stub

}
项目:libGdx-xiyou    文件:Box2DContactListener.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
}
项目:JavityEngine    文件:JComponent.java   
@Override
public void onCollisionPreSolve(Contact contact, Manifold oldManifold) {
}
项目:M-M    文件:ContactService.java   
@Override
public void preSolve(final Contact contact, final Manifold oldManifold) {
}
项目:advio    文件:ContactListener.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
}
项目:libgdxjam    文件:ContactAdapter.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {}
项目:libgdxGP    文件:ContactMultiListener.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    for (ContactListener contactListener : contactListeners) {
        contactListener.preSolve(contact, oldManifold);
    }
}
项目:Pacman_libGdx    文件:WorldContactListener.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
}
项目:AI_TestBed_v3    文件:CollisionListener.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    contact.setEnabled(false);

}
项目:BlockBunny    文件:BBContactListener.java   
public void preSolve(Contact c, Manifold m) {
}
项目:Dodgy-Dot    文件:GameScreen.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    // TODO Auto-generated method stub
}
项目:Vector-Pinball-Editor    文件:Field.java   
@Override public void preSolve(Contact arg0, Manifold arg1) {
    // Not used.
}
项目:KillTheNerd    文件:MyContactListener.java   
@Override
public void preSolve(final Contact contact, final Manifold oldManifold) {
    //
}
项目:Pong-Tutorial    文件:Ball.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    // TODO Auto-generated method stub

}
项目:Pong-Tutorial    文件:Bounds.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    // TODO Auto-generated method stub

}
项目:Pong-Tutorial    文件:Player.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    // TODO Auto-generated method stub

}
项目:GDXJam    文件:GameContactListener.java   
@Override
public void preSolve (Contact contact, Manifold oldManifold) {
    // TODO Auto-generated method stub

}
项目:tilt-game-android    文件:ContactListenerAdapter.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
}
项目:Bomberman_libGdx    文件:B2DWorldContactListener.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
}
项目:practicos    文件:AdministradorColisiones.java   
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
    // TODO Auto-generated method stub

}
项目:CodeBase    文件:PhysixContactAdapter.java   
public void preSolve(PhysixContact contact, Manifold oldManifold) {
}
项目:CodeBase    文件:PhysixComponentAwareContactListener.java   
public void preSolve(Contact contact, Manifold oldManifold) {
    testAndRun(contact, (PhysixContact physixContact) -> preSolve(physixContact, oldManifold));
}