use of com.badlogic.gdx.physics.box2d.Shape in project commons-gdx by gemserk.
the class Box2dUtils method translateFixtures.
/**
* Internally translates all the Body's fixtures the specified translation, without moving the Body's center. For now, it generates garbage so should be used only once.
*
* @param body
* The body to work on.
* @param tx
* The translation in x coordinate.
* @param ty
* The translation in y coordinate.
*/
public static void translateFixtures(ArrayList<Fixture> fixtures, float tx, float ty) {
// TODO: should be in a Box2dUtils
for (int i = 0; i < fixtures.size(); i++) {
Fixture fixture = fixtures.get(i);
Shape shape = fixture.getShape();
if (shape.getType() == Type.Polygon)
ShapeUtils.translatePolygonShape((PolygonShape) shape, tx, ty);
else if (shape.getType() == Type.Circle)
ShapeUtils.translateCircleShape((CircleShape) shape, tx, ty);
}
}
use of com.badlogic.gdx.physics.box2d.Shape in project commons-gdx by gemserk.
the class FixtureDefBuilder method circleShape.
public FixtureDefBuilder circleShape(float radius) {
Shape shape = new CircleShape();
shape.setRadius(radius);
fixtureDef.shape = shape;
return this;
}
Aggregations