本文整理匯總了Java中com.badlogic.gdx.physics.box2d.Manifold類的典型用法代碼示例。如果您正苦於以下問題:Java Manifold類的具體用法?Java Manifold怎麽用?Java Manifold使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Manifold類屬於com.badlogic.gdx.physics.box2d包,在下文中一共展示了Manifold類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPreSolveContact
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@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);
}
}
}
}
示例2: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@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());
}
}
示例3: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@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);
}
}
}
示例4: onContact
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@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;
}
}
示例5: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
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;
}
}
示例6: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@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);
}
}
}
示例7: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@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();
}
}
示例8: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@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);
}
}
示例9: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@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);
}
}
示例10: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
if (contact.getFixtureA() != null && contact.getFixtureB() != null) {
for (ComponentContactListener listener : listenerMap.values()) {
listener.preSolve(contact, oldManifold);
}
}
}
示例11: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
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);
}
}
示例12: onContact
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@Override
public void onContact(B2FlxShape sprite1, B2FlxShape sprite2, Contact contact, Manifold oldManifold, ContactImpulse impulse)
{
_ghost2.removeOverlap();
if(!_ghost2.gotOverlaps())
_ghost2.setAlpha(1f);
}
示例13: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
/**
* 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);
}
示例14: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@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);
}
示例15: preSolve
import com.badlogic.gdx.physics.box2d.Manifold; //導入依賴的package包/類
@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);
}
}
}
}