本文整理汇总了Java中org.box2d.proto.Box2D.PbBody.getBullet方法的典型用法代码示例。如果您正苦于以下问题:Java PbBody.getBullet方法的具体用法?Java PbBody.getBullet怎么用?Java PbBody.getBullet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.box2d.proto.Box2D.PbBody
的用法示例。
在下文中一共展示了PbBody.getBullet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserializeBody
import org.box2d.proto.Box2D.PbBody; //导入方法依赖的package包/类
public Body deserializeBody(World argWorld, PbBody argBody) {
PbBody b = argBody;
BodyDef bd = new BodyDef();
bd.position.set(pbToVec(b.getPosition()));
bd.angle = b.getAngle();
bd.linearDamping = b.getLinearDamping();
bd.angularDamping = b.getAngularDamping();
bd.gravityScale = b.getGravityScale();
// velocities are populated after fixture addition
bd.bullet = b.getBullet();
bd.allowSleep = b.getAllowSleep();
bd.awake = b.getAwake();
bd.active = b.getActive();
bd.fixedRotation = b.getFixedRotation();
switch (b.getType()) {
case DYNAMIC:
bd.type = BodyType.DYNAMIC;
break;
case KINEMATIC:
bd.type = BodyType.KINEMATIC;
break;
case STATIC:
bd.type = BodyType.STATIC;
break;
default:
UnsupportedObjectException e =
new UnsupportedObjectException("Unknown body type: " + argBody.getType(), Type.BODY);
if (ulistener == null || ulistener.isUnsupported(e)) {
throw e;
}
return null;
}
Body body = argWorld.createBody(bd);
for (int i = 0; i < b.getFixturesCount(); i++) {
deserializeFixture(body, b.getFixtures(i));
}
// adding fixtures can change this, so we put this here and set it directly in the body
body.m_linearVelocity.set(pbToVec(b.getLinearVelocity()));
body.m_angularVelocity = b.getAngularVelocity();
if (listener != null && b.hasTag()) {
listener.processBody(body, b.getTag());
}
return body;
}