List of usage examples for com.badlogic.gdx.physics.box2d Body isFixedRotation
public boolean isFixedRotation()
From source file:com.stercore.code.net.dermetfan.utils.libgdx.box2d.Box2DUtils.java
License:Apache License
/** @param body the body for which to setup a new {@link BodyDef} * @return a new {@link BodyDef} instance that can be used to clone the given body */ public static BodyDef createDef(Body body) { BodyDef bodyDef = new BodyDef(); bodyDef.active = body.isActive();/* w w w. ja va 2 s . c o m*/ bodyDef.allowSleep = body.isSleepingAllowed(); bodyDef.angle = body.getAngle(); bodyDef.angularDamping = body.getAngularDamping(); bodyDef.angularVelocity = body.getAngularVelocity(); bodyDef.awake = body.isAwake(); bodyDef.bullet = body.isBullet(); bodyDef.fixedRotation = body.isFixedRotation(); bodyDef.gravityScale = body.getGravityScale(); bodyDef.linearDamping = body.getLinearDamping(); bodyDef.linearVelocity.set(body.getLinearVelocity()); bodyDef.position.set(body.getPosition()); bodyDef.type = body.getType(); return bodyDef; }
From source file:net.dermetfan.utils.libgdx.box2d.Box2DUtils.java
License:Apache License
/** creates a deep copy of a {@link Body} * @param body the {@link Body} to copy * @param shapes if the {@link Shape Shapes} of the {@link Fixture Fixures} of the given {@code body} should be {@link #copy(Shape) copied} as well * @return a deep copy of the given {@code body} */ public static Body copy(Body body, boolean shapes) { BodyDef bodyDef = new BodyDef(); bodyDef.active = body.isActive();// ww w. j a va 2 s . co m bodyDef.allowSleep = body.isSleepingAllowed(); bodyDef.angle = body.getAngle(); bodyDef.angularDamping = body.getAngularDamping(); bodyDef.angularVelocity = body.getAngularVelocity(); bodyDef.awake = body.isAwake(); bodyDef.bullet = body.isBullet(); bodyDef.fixedRotation = body.isFixedRotation(); bodyDef.gravityScale = body.getGravityScale(); bodyDef.linearDamping = body.getLinearDamping(); bodyDef.linearVelocity.set(body.getLinearVelocity()); bodyDef.position.set(body.getPosition()); bodyDef.type = body.getType(); Body copy = body.getWorld().createBody(bodyDef); copy.setUserData(body.getUserData()); for (Fixture fixture : body.getFixtureList()) copy(fixture, copy, shapes); return copy; }
From source file:org.ams.physics.things.def.DefParser.java
License:Open Source License
public static void thingWithBodyToDefinition(ThingWithBody thingWithBody, ThingWithBodyDef def) { Body body = thingWithBody.getBody(); Fixture firstFixture = body.getFixtureList().first(); thingToDefinition(thingWithBody, def); def.active = body.isActive();//from w w w . ja v a2s. co m def.angle = body.getAngle(); def.angularDamping = body.getAngularDamping(); def.antiCollisionGroup = thingWithBody.getAntiCollisionGroup(); def.awake = body.isAwake(); def.bullet = body.isBullet(); def.categoryBits = firstFixture.getFilterData().categoryBits; def.density = firstFixture.getDensity(); def.fixedRotation = body.isFixedRotation(); def.friction = firstFixture.getFriction(); def.groupIndex = firstFixture.getFilterData().groupIndex; def.linearDamping = body.getLinearDamping(); def.maskBits = firstFixture.getFilterData().maskBits; def.position.set(body.getPosition()); def.restitution = firstFixture.getRestitution(); def.type = body.getType(); }