当前位置: 首页>>代码示例>>Java>>正文


Java Manifold类代码示例

本文整理汇总了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);
            }
        }

    }

}
 
开发者ID:sergiotorresperez,项目名称:jumplings,代码行数:23,代码来源:JumplingActor.java

示例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());
    }
}
 
开发者ID:MosaicOwl,项目名称:the-erder,代码行数:21,代码来源:CollisionListener.java

示例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);
		}
	}
}
 
开发者ID:underclocker,项目名称:Blob-Game,代码行数:21,代码来源:BlobDetangler.java

示例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;
	}
}
 
开发者ID:flixel-gdx,项目名称:flixel-gdx-box2d,代码行数:24,代码来源:TestBreakable.java

示例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;
	}	
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:28,代码来源:ContactManager.java

示例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);
        }
    }
}
 
开发者ID:Xemiru,项目名称:Undertailor,代码行数:11,代码来源:CollisionHandler.java

示例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();
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:11,代码来源:PlayerLevelContactListener.java

示例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);
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:15,代码来源:CollisionHandler.java

示例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);
	}
}
 
开发者ID:saltares,项目名称:sioncore,代码行数:13,代码来源:CollisionHandler.java

示例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);
        }
    }
}
 
开发者ID:GameDevWeek,项目名称:CodeBase,代码行数:9,代码来源:PhysixComponentAwareContactListener.java

示例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);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:9,代码来源:ConveyorBelt.java

示例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);
}
 
开发者ID:flixel-gdx,项目名称:flixel-gdx-box2d,代码行数:8,代码来源:TestCollisionDetection.java

示例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);
}
 
开发者ID:flixel-gdx,项目名称:flixel-gdx-box2d,代码行数:17,代码来源:B2FlxContactListener.java

示例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);
}
 
开发者ID:Rubentxu,项目名称:DreamsLibGdx,代码行数:10,代码来源:WorldController.java

示例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);
			}
		}

	}
}
 
开发者ID:LostCodeStudios,项目名称:JavaLib,代码行数:32,代码来源:ContactManager.java


注:本文中的com.badlogic.gdx.physics.box2d.Manifold类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。