本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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();
}
示例5: initialValue
import org.jbox2d.collision.WorldManifold; //导入依赖的package包/类
protected final WorldManifold initialValue(){
return new WorldManifold();
}