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


Java WorldManifold类代码示例

本文整理汇总了Java中org.jbox2d.collision.WorldManifold的典型用法代码示例。如果您正苦于以下问题:Java WorldManifold类的具体用法?Java WorldManifold怎么用?Java WorldManifold使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WorldManifold类属于org.jbox2d.collision包,在下文中一共展示了WorldManifold类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: beginContact

import org.jbox2d.collision.WorldManifold; //导入依赖的package包/类
@Override
public void beginContact(Contact contact) {
    WorldManifold worldManifold = new WorldManifold();
    contact.getWorldManifold(worldManifold);
    
    Object bodyDataA = contact.getFixtureA().getBody().getUserData();
    if (bodyDataA instanceof Character) {
        ((Character) bodyDataA).numContacts++;
    }
    
    Object bodyDataB = contact.getFixtureB().getBody().getUserData();
    if (bodyDataB instanceof Character) {
        ((Character) bodyDataB).numContacts++;
    }
    
    if (bodyDataA instanceof Character && bodyDataB instanceof Bullet) {
        doDamage((Character) bodyDataA, (Bullet) bodyDataB);
    } else if (bodyDataB instanceof Character && bodyDataA instanceof Bullet) {
        doDamage((Character) bodyDataB, (Bullet) bodyDataA);
    }
}
 
开发者ID:Rekkyn,项目名称:projectradon,代码行数:22,代码来源:PlayerContactListener.java

示例2: getWorldManifold

import org.jbox2d.collision.WorldManifold; //导入依赖的package包/类
/**
 * Get the world manifold.
 */
public void getWorldManifold(WorldManifold worldManifold) {
  final Body bodyA = m_fixtureA.getBody();
  final Body bodyB = m_fixtureB.getBody();
  final Shape shapeA = m_fixtureA.getShape();
  final Shape shapeB = m_fixtureB.getShape();

  worldManifold.initialize(m_manifold, bodyA.getTransform(), shapeA.m_radius,
      bodyB.getTransform(), shapeB.m_radius);
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:13,代码来源:Contact.java

示例3: getWorldManifold

import org.jbox2d.collision.WorldManifold; //导入依赖的package包/类
/**
 * Get the world manifold.
 */
public void getWorldManifold(WorldManifold worldManifold) {
	final Body bodyA = m_fixtureA.getBody();
	final Body bodyB = m_fixtureB.getBody();
	final Shape shapeA = m_fixtureA.getShape();
	final Shape shapeB = m_fixtureB.getShape();

	worldManifold.initialize(m_manifold, bodyA.getTransform(),
			shapeA.m_radius, bodyB.getTransform(), shapeB.m_radius);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:Contact.java

示例4: ContactTable

import org.jbox2d.collision.WorldManifold; //导入依赖的package包/类
public ContactTable(Contact contact, boolean swap)
{
    table = LuaTable.tableOf();
    this.contact = contact;
    
    Fixture fixtureA = swap ? contact.m_fixtureB : contact.m_fixtureA;
    Fixture fixtureB = swap ? contact.m_fixtureA : contact.m_fixtureB;
    PhysicsComponent bodyA = (PhysicsComponent) fixtureA.m_body.m_userData;
    PhysicsComponent bodyB = (PhysicsComponent) fixtureB.m_body.m_userData;
    table.set("bodyA", bodyA.identifier);
    table.set("bodyB", bodyB.identifier);

    PhysicsShape shapeA = (PhysicsShape) fixtureA.m_userData;
    PhysicsShape shapeB = (PhysicsShape) fixtureB.m_userData;
    table.set("shapeA", LuaValue.valueOf(shapeA.identifier));
    table.set("shapeB", LuaValue.valueOf(shapeB.identifier));
    
    WorldManifold manifold = new WorldManifold();
    contact.getWorldManifold(manifold);
    Vec2 pointA = manifold.points[swap ? 1 : 0];
    Vec2 pointB = manifold.points[swap ? 0 : 1];
    Vec2 normal = manifold.normal;
    
    table.set("pointAx", LuaValue.valueOf(pointA.x));
    table.set("pointAy", LuaValue.valueOf(pointA.y));
    table.set("pointBx", LuaValue.valueOf(pointB.x));
    table.set("pointBy", LuaValue.valueOf(pointB.y));
    table.set("normalX", LuaValue.valueOf(normal.x));
    table.set("normalY", LuaValue.valueOf(normal.y));
    
    for (FuncData func : FuncData.values())
        new LimeFunc(func).addToTable();
}
 
开发者ID:LoDoMa,项目名称:Lime,代码行数:34,代码来源:ContactTable.java

示例5: initialValue

import org.jbox2d.collision.WorldManifold; //导入依赖的package包/类
protected final WorldManifold initialValue(){
	return new WorldManifold();
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:4,代码来源:TLWorldManifold.java


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