Package net.dermetfan.gdx.physics.box2d
Class Box2DUtils
java.lang.Object
net.dermetfan.gdx.physics.box2d.Box2DUtils
public class Box2DUtils
extends java.lang.Object
provides methods for operations with Box2D 
Bodies, Fixtures and Shapes- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classBox2DUtils.PreconditionCheckchecks if Box2D's preconditions are met to avoid native crashesstatic classBox2DUtils.Settingsb2Settings.hstatic classBox2DUtils.ShapeCachecached method results
- 
Field SummaryFields Modifier and Type Field Description static booleanautoCacheif shapes should automatically be cached when they are inspected for the first timestatic com.badlogic.gdx.utils.ObjectMap<com.badlogic.gdx.physics.box2d.Shape,Box2DUtils.ShapeCache>cacheCachedShapesand theirBox2DUtils.ShapeCache.static Box2DUtils.PreconditionCheckcheckthe PreconditionCheck to use
- 
Constructor SummaryConstructors Constructor Description Box2DUtils()
- 
Method SummaryModifier and Type Method Description static com.badlogic.gdx.math.Rectangleaabb(com.badlogic.gdx.physics.box2d.Body body)static com.badlogic.gdx.math.Rectangleaabb(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.math.Rectangle aabb)static com.badlogic.gdx.math.Rectangleaabb(com.badlogic.gdx.physics.box2d.Fixture fixture)static com.badlogic.gdx.math.Rectangleaabb(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Rectangle aabb)static com.badlogic.gdx.math.Rectangleaabb(com.badlogic.gdx.physics.box2d.Shape shape, float rotation)static com.badlogic.gdx.math.Rectangleaabb(com.badlogic.gdx.physics.box2d.Shape shape, float rotation, com.badlogic.gdx.math.Rectangle aabb)static com.badlogic.gdx.math.Polylineas(com.badlogic.gdx.physics.box2d.ChainShape shape, com.badlogic.gdx.math.Polyline polyline)static com.badlogic.gdx.math.Circleas(com.badlogic.gdx.physics.box2d.CircleShape shape, com.badlogic.gdx.math.Circle circle)static com.badlogic.gdx.math.Polylineas(com.badlogic.gdx.physics.box2d.EdgeShape shape, com.badlogic.gdx.math.Polyline polyline)static com.badlogic.gdx.math.Circleas(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Circle circle)sets the given Circle to the Fixture's CircleShape, in world coordinatesstatic com.badlogic.gdx.math.Polygonas(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Polygon polygon)sets the given Polygon to the Fixture's PolygonShape, in world coordinatesstatic com.badlogic.gdx.math.Polylineas(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Polyline polyline)sets the given Polyline to the given Fixture's EdgeShape or ChainShape, in world coordinatesstatic com.badlogic.gdx.math.Polygonas(com.badlogic.gdx.physics.box2d.PolygonShape shape, com.badlogic.gdx.math.Polygon polygon)static Box2DUtils.ShapeCachecache(com.badlogic.gdx.physics.box2d.Shape shape)static com.badlogic.gdx.physics.box2d.Bodyclone(com.badlogic.gdx.physics.box2d.Body body)clones a Body (without deep copying the Shapes of its Fixtures)static com.badlogic.gdx.physics.box2d.Bodyclone(com.badlogic.gdx.physics.box2d.Body body, boolean shapes)clones a Bodystatic com.badlogic.gdx.physics.box2d.Fixtureclone(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.physics.box2d.Body body)clones a Fixture (without deep copying its Shape)static com.badlogic.gdx.physics.box2d.Fixtureclone(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.physics.box2d.Body body, boolean shape)clones a Fixturestatic <T extends com.badlogic.gdx.physics.box2d.Shape>
 Tclone(T shape)creates a deep copy of a Shapestatic com.badlogic.gdx.physics.box2d.BodyDefcreateDef(com.badlogic.gdx.physics.box2d.Body body)static com.badlogic.gdx.physics.box2d.FixtureDefcreateDef(com.badlogic.gdx.physics.box2d.Fixture fixture)static com.badlogic.gdx.physics.box2d.JointDefcreateDef(com.badlogic.gdx.physics.box2d.Joint joint)static com.badlogic.gdx.physics.box2d.joints.DistanceJointDefcreateDef(com.badlogic.gdx.physics.box2d.joints.DistanceJoint joint)static com.badlogic.gdx.physics.box2d.joints.FrictionJointDefcreateDef(com.badlogic.gdx.physics.box2d.joints.FrictionJoint joint)static com.badlogic.gdx.physics.box2d.joints.GearJointDefcreateDef(com.badlogic.gdx.physics.box2d.joints.GearJoint joint)static com.badlogic.gdx.physics.box2d.joints.MotorJointDefcreateDef(com.badlogic.gdx.physics.box2d.joints.MotorJoint joint)static com.badlogic.gdx.physics.box2d.joints.MouseJointDefcreateDef(com.badlogic.gdx.physics.box2d.joints.MouseJoint joint)static com.badlogic.gdx.physics.box2d.joints.PrismaticJointDefcreateDef(com.badlogic.gdx.physics.box2d.joints.PrismaticJoint joint)static com.badlogic.gdx.physics.box2d.joints.PulleyJointDefcreateDef(com.badlogic.gdx.physics.box2d.joints.PulleyJoint joint)static com.badlogic.gdx.physics.box2d.joints.RevoluteJointDefcreateDef(com.badlogic.gdx.physics.box2d.joints.RevoluteJoint joint)static com.badlogic.gdx.physics.box2d.joints.RopeJointDefcreateDef(com.badlogic.gdx.physics.box2d.joints.RopeJoint joint)static com.badlogic.gdx.physics.box2d.joints.WeldJointDefcreateDef(com.badlogic.gdx.physics.box2d.joints.WeldJoint joint)static com.badlogic.gdx.physics.box2d.joints.WheelJointDefcreateDef(com.badlogic.gdx.physics.box2d.joints.WheelJoint joint)static voiddestroyFixtures(com.badlogic.gdx.physics.box2d.Body body)destroysall fixtures of the given bodystatic voiddestroyFixtures(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.physics.box2d.Fixture exclude)static voiddestroyFixtures(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.physics.box2d.Fixture... exclude)static voiddestroyFixtures(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Fixture> exclude)destroysall fixtures of the given body except the given onesstatic booleanequals(com.badlogic.gdx.physics.box2d.Filter a, com.badlogic.gdx.physics.box2d.Filter b)static booleanequals(com.badlogic.gdx.physics.box2d.MassData a, com.badlogic.gdx.physics.box2d.MassData b)static booleanequals(com.badlogic.gdx.physics.box2d.Transform a, com.badlogic.gdx.physics.box2d.Transform b)static float[][]fixtureVertices(com.badlogic.gdx.physics.box2d.Body body)static floatheight(com.badlogic.gdx.physics.box2d.Body body)static floatheight(com.badlogic.gdx.physics.box2d.Fixture fixture)static floatheight(com.badlogic.gdx.physics.box2d.Shape shape)static floatmaxX(com.badlogic.gdx.physics.box2d.Body body)static floatmaxX(com.badlogic.gdx.physics.box2d.Fixture fixture)static floatmaxX(com.badlogic.gdx.physics.box2d.Shape shape)static floatmaxXWorld(com.badlogic.gdx.physics.box2d.Body body)static floatmaxXWorld(com.badlogic.gdx.physics.box2d.Fixture fixture)static floatmaxY(com.badlogic.gdx.physics.box2d.Body body)static floatmaxY(com.badlogic.gdx.physics.box2d.Fixture fixture)static floatmaxY(com.badlogic.gdx.physics.box2d.Shape shape)static floatmaxYWorld(com.badlogic.gdx.physics.box2d.Body body)static floatmaxYWorld(com.badlogic.gdx.physics.box2d.Fixture fixture)static floatminX(com.badlogic.gdx.physics.box2d.Body body)static floatminX(com.badlogic.gdx.physics.box2d.Fixture fixture)static floatminX(com.badlogic.gdx.physics.box2d.Shape shape)static floatminXWorld(com.badlogic.gdx.physics.box2d.Body body)static floatminXWorld(com.badlogic.gdx.physics.box2d.Fixture fixture)static floatminY(com.badlogic.gdx.physics.box2d.Body body)static floatminY(com.badlogic.gdx.physics.box2d.Fixture fixture)static floatminY(com.badlogic.gdx.physics.box2d.Shape shape)static floatminYWorld(com.badlogic.gdx.physics.box2d.Body body)static floatminYWorld(com.badlogic.gdx.physics.box2d.Fixture fixture)static com.badlogic.gdx.math.Vector2position(com.badlogic.gdx.physics.box2d.Fixture fixture)static com.badlogic.gdx.math.Vector2position(com.badlogic.gdx.physics.box2d.Shape shape, com.badlogic.gdx.physics.box2d.Body body)static com.badlogic.gdx.math.Vector2positionRelative(com.badlogic.gdx.physics.box2d.CircleShape shape)static com.badlogic.gdx.math.Vector2positionRelative(com.badlogic.gdx.physics.box2d.Fixture fixture)static com.badlogic.gdx.math.Vector2positionRelative(com.badlogic.gdx.physics.box2d.Shape shape, float rotation)static com.badlogic.gdx.physics.box2d.BodyDefreset(com.badlogic.gdx.physics.box2d.BodyDef bodyDef)static com.badlogic.gdx.physics.box2d.FixtureDefreset(com.badlogic.gdx.physics.box2d.FixtureDef fixtureDef)static com.badlogic.gdx.physics.box2d.BodyDefset(com.badlogic.gdx.physics.box2d.BodyDef bodyDef, com.badlogic.gdx.physics.box2d.Body body)static com.badlogic.gdx.physics.box2d.FixtureDefset(com.badlogic.gdx.physics.box2d.FixtureDef fixtureDef, com.badlogic.gdx.physics.box2d.Fixture fixture)static com.badlogic.gdx.physics.box2d.JointDefset(com.badlogic.gdx.physics.box2d.JointDef jointDef, com.badlogic.gdx.physics.box2d.Joint joint)static com.badlogic.gdx.physics.box2d.joints.DistanceJointDefset(com.badlogic.gdx.physics.box2d.joints.DistanceJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.DistanceJoint joint)static com.badlogic.gdx.physics.box2d.joints.FrictionJointDefset(com.badlogic.gdx.physics.box2d.joints.FrictionJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.FrictionJoint joint)static com.badlogic.gdx.physics.box2d.joints.GearJointDefset(com.badlogic.gdx.physics.box2d.joints.GearJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.GearJoint joint)static com.badlogic.gdx.physics.box2d.joints.MotorJointDefset(com.badlogic.gdx.physics.box2d.joints.MotorJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.MotorJoint joint)static com.badlogic.gdx.physics.box2d.joints.MouseJointDefset(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.MouseJoint joint)static com.badlogic.gdx.physics.box2d.joints.PrismaticJointDefset(com.badlogic.gdx.physics.box2d.joints.PrismaticJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.PrismaticJoint joint)static com.badlogic.gdx.physics.box2d.joints.PulleyJointDefset(com.badlogic.gdx.physics.box2d.joints.PulleyJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.PulleyJoint joint)static com.badlogic.gdx.physics.box2d.joints.RevoluteJointDefset(com.badlogic.gdx.physics.box2d.joints.RevoluteJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.RevoluteJoint joint)static com.badlogic.gdx.physics.box2d.joints.RopeJointDefset(com.badlogic.gdx.physics.box2d.joints.RopeJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.RopeJoint joint)static com.badlogic.gdx.physics.box2d.joints.WeldJointDefset(com.badlogic.gdx.physics.box2d.joints.WeldJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.WeldJoint joint)Note: The reference angle cannot be set due to the Box2D API not providing it.static com.badlogic.gdx.physics.box2d.joints.WheelJointDefset(com.badlogic.gdx.physics.box2d.joints.WheelJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.WheelJoint joint)static voidsetSensor(com.badlogic.gdx.physics.box2d.Body body, boolean sensor)sets thesensor flagsof all of the given Body's Fixturesstatic com.badlogic.gdx.math.Vector2size(com.badlogic.gdx.physics.box2d.Body body)static com.badlogic.gdx.math.Vector2size(com.badlogic.gdx.physics.box2d.Fixture fixture)static com.badlogic.gdx.math.Vector2size(com.badlogic.gdx.physics.box2d.Shape shape)static booleansplit(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, net.dermetfan.utils.Pair<com.badlogic.gdx.physics.box2d.Body,com.badlogic.gdx.physics.box2d.Body> store)static booleansplit(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, com.badlogic.gdx.physics.box2d.Body aBody, com.badlogic.gdx.physics.box2d.Body bBody, net.dermetfan.utils.Pair<com.badlogic.gdx.physics.box2d.Fixture,com.badlogic.gdx.physics.box2d.Fixture> store)static booleansplit(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, net.dermetfan.utils.Pair<com.badlogic.gdx.physics.box2d.FixtureDef,com.badlogic.gdx.physics.box2d.FixtureDef> store)static <T extends com.badlogic.gdx.physics.box2d.Shape>
 booleansplit(T shape, com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, net.dermetfan.utils.Pair<T,T> store)splits the given Shape using the segment described by the two given Vector2sstatic float[]toLocalVertices(float[] vertices, int offset, int length, com.badlogic.gdx.physics.box2d.Body body)static float[]toLocalVertices(float[] vertices, com.badlogic.gdx.physics.box2d.Body body)static float[]toWorldVertices(float[] vertices, int offset, int length, com.badlogic.gdx.physics.box2d.Body body)static float[]toWorldVertices(float[] vertices, com.badlogic.gdx.physics.box2d.Body body)static float[]vertices(com.badlogic.gdx.physics.box2d.Fixture fixture)static float[]vertices(com.badlogic.gdx.physics.box2d.Shape shape)static intweld(float[] vertices)static intweld(float[] vertices, int offset, int length)welds the given vertices together the wayPolygonShape.set(float[])doesstatic intweld(com.badlogic.gdx.utils.FloatArray vertices)static floatwidth(com.badlogic.gdx.physics.box2d.Body body)static floatwidth(com.badlogic.gdx.physics.box2d.Fixture fixture)static floatwidth(com.badlogic.gdx.physics.box2d.Shape shape)Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Field Details- 
cachepublic static final com.badlogic.gdx.utils.ObjectMap<com.badlogic.gdx.physics.box2d.Shape,Box2DUtils.ShapeCache> cacheCachedShapesand theirBox2DUtils.ShapeCache. You shouldclearthis when you don't use the shapes anymore.
- 
autoCachepublic static boolean autoCacheif shapes should automatically be cached when they are inspected for the first time
- 
checkthe PreconditionCheck to use
 
- 
- 
Constructor Details- 
Box2DUtilspublic Box2DUtils()
 
- 
- 
Method Details- 
cache- Parameters:
- shape- the Shape to create a new- Box2DUtils.ShapeCachefor that will be added to- cache
 
- 
verticespublic static float[] vertices(com.badlogic.gdx.physics.box2d.Shape shape)- Returns:
- the vertices of the given Shape
 
- 
minXpublic static float minX(com.badlogic.gdx.physics.box2d.Shape shape)- Returns:
- the minimal x value of the vertices of the given Shape
 
- 
minYpublic static float minY(com.badlogic.gdx.physics.box2d.Shape shape)- Returns:
- the minimal y value of the vertices of the given Shape
 
- 
maxXpublic static float maxX(com.badlogic.gdx.physics.box2d.Shape shape)- Returns:
- the maximal x value of the vertices of the given Shape
 
- 
maxYpublic static float maxY(com.badlogic.gdx.physics.box2d.Shape shape)- Returns:
- the maximal y value of the vertices of the given Shape
 
- 
widthpublic static float width(com.badlogic.gdx.physics.box2d.Shape shape)- Returns:
- the width of the given Shape
 
- 
heightpublic static float height(com.badlogic.gdx.physics.box2d.Shape shape)- Returns:
- the height of the given Shape
 
- 
sizepublic static com.badlogic.gdx.math.Vector2 size(com.badlogic.gdx.physics.box2d.Shape shape)- Returns:
- a Vector2representing the size of the given Shape
 
- 
verticespublic static float[] vertices(com.badlogic.gdx.physics.box2d.Fixture fixture)- See Also:
- vertices(Shape)
 
- 
minXpublic static float minX(com.badlogic.gdx.physics.box2d.Fixture fixture)- See Also:
- minX(Shape)
 
- 
minYpublic static float minY(com.badlogic.gdx.physics.box2d.Fixture fixture)- See Also:
- minY(Shape)
 
- 
maxXpublic static float maxX(com.badlogic.gdx.physics.box2d.Fixture fixture)- See Also:
- maxX(Shape)
 
- 
maxYpublic static float maxY(com.badlogic.gdx.physics.box2d.Fixture fixture)- See Also:
- maxY(Shape)
 
- 
minXWorldpublic static float minXWorld(com.badlogic.gdx.physics.box2d.Fixture fixture)- Returns:
- the minimal x coordinate of the vertices of the given Fixture in world coordinates
 
- 
minYWorldpublic static float minYWorld(com.badlogic.gdx.physics.box2d.Fixture fixture)- Returns:
- the minimal y coordinate of the vertices of the given Fixture in world coordinates
 
- 
maxXWorldpublic static float maxXWorld(com.badlogic.gdx.physics.box2d.Fixture fixture)- Returns:
- the maximal x coordinate of the vertices of the given Fixture in world coordinates
 
- 
maxYWorldpublic static float maxYWorld(com.badlogic.gdx.physics.box2d.Fixture fixture)- Returns:
- the maximal y coordinate of the vertices of the given Fixture in world coordinates
 
- 
widthpublic static float width(com.badlogic.gdx.physics.box2d.Fixture fixture)- See Also:
- width(Shape)
 
- 
heightpublic static float height(com.badlogic.gdx.physics.box2d.Fixture fixture)- See Also:
- height(Shape)
 
- 
sizepublic static com.badlogic.gdx.math.Vector2 size(com.badlogic.gdx.physics.box2d.Fixture fixture)- See Also:
- size(Shape)
 
- 
fixtureVerticespublic static float[][] fixtureVertices(com.badlogic.gdx.physics.box2d.Body body)- Returns:
- the vertices of all fixtures of a body
 
- 
minXpublic static float minX(com.badlogic.gdx.physics.box2d.Body body)- Returns:
- the minimal x value of the vertices of all fixtures of the the given Body
 
- 
minYpublic static float minY(com.badlogic.gdx.physics.box2d.Body body)- Returns:
- the minimal y value of the vertices of all fixtures of the the given Body
 
- 
maxXpublic static float maxX(com.badlogic.gdx.physics.box2d.Body body)- Returns:
- the maximal x value of the vertices of all fixtures of the the given Body
 
- 
maxYpublic static float maxY(com.badlogic.gdx.physics.box2d.Body body)- Returns:
- the maximal y value of the vertices of all fixtures of the the given Body
 
- 
minXWorldpublic static float minXWorld(com.badlogic.gdx.physics.box2d.Body body)- Returns:
- the minimal x coordinate of the vertices of all fixtures of the given Body in world coordinates
 
- 
minYWorldpublic static float minYWorld(com.badlogic.gdx.physics.box2d.Body body)- Returns:
- the minimal y coordinate of the vertices of all fixtures of the given Body in world coordinates
 
- 
maxXWorldpublic static float maxXWorld(com.badlogic.gdx.physics.box2d.Body body)- Returns:
- the maximal x coordinate of the vertices of all fixtures of the given Body in world coordinates
 
- 
maxYWorldpublic static float maxYWorld(com.badlogic.gdx.physics.box2d.Body body)- Returns:
- the maximal y coordinate of the vertices of all fixtures of the given Body in world coordinates
 
- 
widthpublic static float width(com.badlogic.gdx.physics.box2d.Body body)- Returns:
- the width of the given Body
 
- 
heightpublic static float height(com.badlogic.gdx.physics.box2d.Body body)- Returns:
- the height of the given Body
 
- 
sizepublic static com.badlogic.gdx.math.Vector2 size(com.badlogic.gdx.physics.box2d.Body body)
- 
positionRelativepublic static com.badlogic.gdx.math.Vector2 positionRelative(com.badlogic.gdx.physics.box2d.CircleShape shape)- See Also:
- positionRelative(Shape, float),- CircleShape.getPosition()
 
- 
positionRelativepublic static com.badlogic.gdx.math.Vector2 positionRelative(com.badlogic.gdx.physics.box2d.Shape shape, float rotation)- Returns:
- the position of the given shape relative to its Body
 
- 
positionpublic static com.badlogic.gdx.math.Vector2 position(com.badlogic.gdx.physics.box2d.Shape shape, com.badlogic.gdx.physics.box2d.Body body)- Parameters:
- shape- the Shape which position to get
- body- the Body the given Shape is attached to
- Returns:
- the position of the given Shape in world coordinates
 
- 
positionRelativepublic static com.badlogic.gdx.math.Vector2 positionRelative(com.badlogic.gdx.physics.box2d.Fixture fixture)- See Also:
- positionRelative(Shape, float)
 
- 
positionpublic static com.badlogic.gdx.math.Vector2 position(com.badlogic.gdx.physics.box2d.Fixture fixture)- See Also:
- position(Shape, Body)
 
- 
aabbpublic static com.badlogic.gdx.math.Rectangle aabb(com.badlogic.gdx.physics.box2d.Shape shape, float rotation, com.badlogic.gdx.math.Rectangle aabb)- Parameters:
- shape- the Shape which AABB to get
- aabb- the Rectangle to set to the given Shape's AABB
- Returns:
- the given Rectangle set as axis aligned bounding box of the given Shape
- Since:
- 0.9.1
 
- 
aabbpublic static com.badlogic.gdx.math.Rectangle aabb(com.badlogic.gdx.physics.box2d.Shape shape, float rotation)- See Also:
- aabb(Shape, float, Rectangle)
 
- 
aabbpublic static com.badlogic.gdx.math.Rectangle aabb(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Rectangle aabb)- Returns:
- the given Rectangle set as axis aligned bounding box of the given Fixture, in world coordinates
- See Also:
- aabb(Shape, float, Rectangle)
 
- 
aabbpublic static com.badlogic.gdx.math.Rectangle aabb(com.badlogic.gdx.physics.box2d.Fixture fixture)- See Also:
- aabb(Fixture, Rectangle)
 
- 
aabbpublic static com.badlogic.gdx.math.Rectangle aabb(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.math.Rectangle aabb)- Returns:
- the given Rectangle set as axis aligned bounding box of all fixtures of the given Body, in world coordinates
- Since:
- 0.9.1
 
- 
aabbpublic static com.badlogic.gdx.math.Rectangle aabb(com.badlogic.gdx.physics.box2d.Body body)- See Also:
- aabb(Body, Rectangle)
 
- 
clonepublic static com.badlogic.gdx.physics.box2d.Body clone(com.badlogic.gdx.physics.box2d.Body body)clones a Body (without deep copying the Shapes of its Fixtures)- Returns:
- copy(body, false)
- See Also:
- clone(Body, boolean)
 
- 
clonepublic static com.badlogic.gdx.physics.box2d.Body clone(com.badlogic.gdx.physics.box2d.Body body, boolean shapes)clones a Body- Parameters:
- body- the Body to copy
- shapes- if the Shapes of the Fixtures of the given Body should be- copiedas well
- Returns:
- a deep copy of the given Body
 
- 
clonepublic static com.badlogic.gdx.physics.box2d.Fixture clone(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.physics.box2d.Body body)clones a Fixture (without deep copying its Shape)- Returns:
- copy(fixture, body, false)
- See Also:
- clone(Fixture, Body, boolean)
 
- 
clonepublic static com.badlogic.gdx.physics.box2d.Fixture clone(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.physics.box2d.Body body, boolean shape)clones a Fixture- Parameters:
- fixture- the Fixture to copy
- body- the Body to create a copy of the given- fixtureon
- shape- if the- shapeof the given Fixture should be deep- copiedas well
- Returns:
- the copied Fixture
 
- 
clonepublic static <T extends com.badlogic.gdx.physics.box2d.Shape> T clone(T shape)creates a deep copy of a Shape- Parameters:
- shape- the Shape to clone
- Returns:
- a Shape exactly like the one passed in
 
- 
clonepublic static <T extends com.badlogic.gdx.physics.box2d.Joint> T clone(T joint)- Parameters:
- joint- the joint to clone
- Since:
- 0.7.1
 
- 
setpublic static com.badlogic.gdx.physics.box2d.BodyDef set(com.badlogic.gdx.physics.box2d.BodyDef bodyDef, com.badlogic.gdx.physics.box2d.Body body)- Parameters:
- bodyDef- the BodyDef to set according to the given Body
- body- the Body to set the given BodyDef accordingly to
- Returns:
- the given BodyDef for chaining
- Since:
- 0.7.1
 
- 
setpublic static com.badlogic.gdx.physics.box2d.FixtureDef set(com.badlogic.gdx.physics.box2d.FixtureDef fixtureDef, com.badlogic.gdx.physics.box2d.Fixture fixture)- Parameters:
- fixtureDef- the FixtureDef to set according to the given Fixture
- fixture- the Fixture to set the given FixtureDef accordingly to
- Returns:
- the given FixtureDef for chaining
- Since:
- 0.7.1
 
- 
setpublic static com.badlogic.gdx.physics.box2d.JointDef set(com.badlogic.gdx.physics.box2d.JointDef jointDef, com.badlogic.gdx.physics.box2d.Joint joint)- Parameters:
- jointDef- the JointDef to set according to the given Joint
- joint- the Joint to set the given JointDef accordingly to
- Returns:
- the given JointDef for chaining
- Since:
- 0.7.1
 
- 
setpublic static com.badlogic.gdx.physics.box2d.joints.DistanceJointDef set(com.badlogic.gdx.physics.box2d.joints.DistanceJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.DistanceJoint joint)- See Also:
- set(JointDef, Joint)
 
- 
setpublic static com.badlogic.gdx.physics.box2d.joints.FrictionJointDef set(com.badlogic.gdx.physics.box2d.joints.FrictionJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.FrictionJoint joint)- See Also:
- set(JointDef, Joint)
 
- 
setpublic static com.badlogic.gdx.physics.box2d.joints.GearJointDef set(com.badlogic.gdx.physics.box2d.joints.GearJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.GearJoint joint)- See Also:
- set(JointDef, Joint)
 
- 
setpublic static com.badlogic.gdx.physics.box2d.joints.MotorJointDef set(com.badlogic.gdx.physics.box2d.joints.MotorJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.MotorJoint joint)- See Also:
- set(JointDef, Joint)
 
- 
setpublic static com.badlogic.gdx.physics.box2d.joints.MouseJointDef set(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.MouseJoint joint)- See Also:
- set(JointDef, Joint)
 
- 
setpublic static com.badlogic.gdx.physics.box2d.joints.RevoluteJointDef set(com.badlogic.gdx.physics.box2d.joints.RevoluteJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.RevoluteJoint joint)- See Also:
- set(JointDef, Joint)
 
- 
setpublic static com.badlogic.gdx.physics.box2d.joints.PrismaticJointDef set(com.badlogic.gdx.physics.box2d.joints.PrismaticJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.PrismaticJoint joint)- See Also:
- set(JointDef, Joint)
 
- 
setpublic static com.badlogic.gdx.physics.box2d.joints.PulleyJointDef set(com.badlogic.gdx.physics.box2d.joints.PulleyJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.PulleyJoint joint)- See Also:
- set(JointDef, Joint)
 
- 
setpublic static com.badlogic.gdx.physics.box2d.joints.WheelJointDef set(com.badlogic.gdx.physics.box2d.joints.WheelJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.WheelJoint joint)- See Also:
- set(JointDef, Joint)
 
- 
setpublic static com.badlogic.gdx.physics.box2d.joints.WeldJointDef set(com.badlogic.gdx.physics.box2d.joints.WeldJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.WeldJoint joint)Note: The reference angle cannot be set due to the Box2D API not providing it.- See Also:
- set(JointDef, Joint)
 
- 
setpublic static com.badlogic.gdx.physics.box2d.joints.RopeJointDef set(com.badlogic.gdx.physics.box2d.joints.RopeJointDef jointDef, com.badlogic.gdx.physics.box2d.joints.RopeJoint joint)- See Also:
- set(JointDef, Joint)
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.BodyDef createDef(com.badlogic.gdx.physics.box2d.Body body)- Parameters:
- body- the body for which to setup a new- BodyDef
- Returns:
- a new BodyDefinstance that can be used to clone the given body
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.FixtureDef createDef(com.badlogic.gdx.physics.box2d.Fixture fixture)- Parameters:
- fixture- the fixture for which to setup a new- FixtureDef
- Returns:
- a new FixtureDefinstance that can be used to clone the given fixture
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.JointDef createDef(com.badlogic.gdx.physics.box2d.Joint joint)- Parameters:
- joint- the joint for which to create a new JointDef
- Returns:
- a new JointDef instance that can be used to clone the given joint
- Since:
- 0.7.1
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.joints.DistanceJointDef createDef(com.badlogic.gdx.physics.box2d.joints.DistanceJoint joint)- See Also:
- createDef(Joint)
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.joints.FrictionJointDef createDef(com.badlogic.gdx.physics.box2d.joints.FrictionJoint joint)- See Also:
- createDef(Joint)
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.joints.GearJointDef createDef(com.badlogic.gdx.physics.box2d.joints.GearJoint joint)- See Also:
- createDef(Joint)
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.joints.MotorJointDef createDef(com.badlogic.gdx.physics.box2d.joints.MotorJoint joint)- See Also:
- createDef(Joint)
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.joints.MouseJointDef createDef(com.badlogic.gdx.physics.box2d.joints.MouseJoint joint)- See Also:
- createDef(Joint)
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.joints.RevoluteJointDef createDef(com.badlogic.gdx.physics.box2d.joints.RevoluteJoint joint)- See Also:
- createDef(Joint)
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.joints.PrismaticJointDef createDef(com.badlogic.gdx.physics.box2d.joints.PrismaticJoint joint)- See Also:
- createDef(Joint)
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.joints.PulleyJointDef createDef(com.badlogic.gdx.physics.box2d.joints.PulleyJoint joint)- See Also:
- createDef(Joint)
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.joints.WheelJointDef createDef(com.badlogic.gdx.physics.box2d.joints.WheelJoint joint)- See Also:
- createDef(Joint)
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.joints.WeldJointDef createDef(com.badlogic.gdx.physics.box2d.joints.WeldJoint joint)- See Also:
- createDef(Joint)
 
- 
createDefpublic static com.badlogic.gdx.physics.box2d.joints.RopeJointDef createDef(com.badlogic.gdx.physics.box2d.joints.RopeJoint joint)- See Also:
- createDef(Joint)
 
- 
splitpublic static boolean split(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, net.dermetfan.utils.Pair<com.badlogic.gdx.physics.box2d.Body,com.badlogic.gdx.physics.box2d.Body> store)- Parameters:
- body- the Body to split
- a- the first point of the segment
- b- the second point of the segment
- store- The- Pairto store the resulting bodies in. May be null.
- Returns:
- If the body was successfully split, which means that all fixtures intersecting with the given segment were split. If false, only some fixtures may have been created!
 
- 
splitpublic static boolean split(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, com.badlogic.gdx.physics.box2d.Body aBody, com.badlogic.gdx.physics.box2d.Body bBody, net.dermetfan.utils.Pair<com.badlogic.gdx.physics.box2d.Fixture,com.badlogic.gdx.physics.box2d.Fixture> store)- Parameters:
- fixture- the fixture to split
- a- the first point of the segment
- b- the second point of the segment
- aBody- The body the first resulting fixture will be created on. No fixture will be created if this is null.
- bBody- The body the second resulting fixture will be created on. No fixture will be created if this is null.
- store- The- Pairto store the resulting fixtures in. May be null.
- Returns:
- if the fixture was split
- See Also:
- split(Shape, Vector2, Vector2, Pair)
 
- 
splitpublic static boolean split(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, net.dermetfan.utils.Pair<com.badlogic.gdx.physics.box2d.FixtureDef,com.badlogic.gdx.physics.box2d.FixtureDef> store)- Parameters:
- fixture- the fixture to split
- a- the first point of the segment
- b- the second point of the segment
- store- the- Pairto store the resulting- FixtureDefsin
- Returns:
- if the fixture was split
- See Also:
- split(Shape, Vector2, Vector2, Pair)
 
- 
splitpublic static <T extends com.badlogic.gdx.physics.box2d.Shape> boolean split(T shape, com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, net.dermetfan.utils.Pair<T,T> store)splits the given Shape using the segment described by the two given Vector2s- Parameters:
- shape- the Shape to split
- a- The first point of the segment. Will be set to the first intersection with the given shape.
- b- The second point of the segment. Will be set to the second intersection with the given shape.
- store- the- Pairto store the split Shapes in
- Returns:
- if the given shape was split
 
- 
weldpublic static int weld(com.badlogic.gdx.utils.FloatArray vertices)- See Also:
- weld(float[], int, int)
 
- 
weldpublic static int weld(float[] vertices)- See Also:
- weld(float[], int, int)
 
- 
weldpublic static int weld(float[] vertices, int offset, int length)welds the given vertices together the wayPolygonShape.set(float[])does- Returns:
- the new number of vertices (starting at offset)
 
- 
aspublic static com.badlogic.gdx.math.Circle as(com.badlogic.gdx.physics.box2d.CircleShape shape, com.badlogic.gdx.math.Circle circle)- Parameters:
- circle- the Circle to set according to the given shape
- Returns:
- the given Circle for chaining
- Since:
- 0.11.1
 
- 
aspublic static com.badlogic.gdx.math.Polygon as(com.badlogic.gdx.physics.box2d.PolygonShape shape, com.badlogic.gdx.math.Polygon polygon)- Parameters:
- polygon- the Polygon which vertices to set according to the given shape
- Returns:
- the given Polygon for chaining
- Since:
- 0.11.1
 
- 
aspublic static com.badlogic.gdx.math.Polyline as(com.badlogic.gdx.physics.box2d.EdgeShape shape, com.badlogic.gdx.math.Polyline polyline)- Parameters:
- polyline- the Polyline which vertices to set according to the given shape
- Returns:
- the given Polyline for chaining
- Since:
- 0.11.1
 
- 
aspublic static com.badlogic.gdx.math.Polyline as(com.badlogic.gdx.physics.box2d.ChainShape shape, com.badlogic.gdx.math.Polyline polyline)- Parameters:
- polyline- the Polyline which vertices to set according to the given shape
- Returns:
- the given Polyline for chaining
- Since:
- 0.11.1
 
- 
aspublic static com.badlogic.gdx.math.Circle as(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Circle circle)sets the given Circle to the Fixture's CircleShape, in world coordinates- Throws:
- java.lang.IllegalArgumentException- if the Fixture's Shape is not of- Shape.Type.Circle
- Since:
- 0.11.1
- See Also:
- as(CircleShape, Circle)
 
- 
aspublic static com.badlogic.gdx.math.Polygon as(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Polygon polygon)sets the given Polygon to the Fixture's PolygonShape, in world coordinates- Throws:
- java.lang.IllegalArgumentException- if the Fixture's Shape is not of- Shape.Type.Polygon
- Since:
- 0.11.1
- See Also:
- as(PolygonShape, Polygon)
 
- 
aspublic static com.badlogic.gdx.math.Polyline as(com.badlogic.gdx.physics.box2d.Fixture fixture, com.badlogic.gdx.math.Polyline polyline)sets the given Polyline to the given Fixture's EdgeShape or ChainShape, in world coordinates- Throws:
- java.lang.IllegalArgumentException- if the Fixture's Shape is neither of- Shape.Type.Edgenor- Shape.Type.Chain
- Since:
- 0.11.1
- See Also:
- as(EdgeShape, Polyline),- as(ChainShape, Polyline)
 
- 
toWorldVerticespublic static float[] toWorldVertices(float[] vertices, int offset, int length, com.badlogic.gdx.physics.box2d.Body body)- Parameters:
- vertices- the local vertices to convert to world vertices
- body- the Body relative to which the given vertices are local
- Returns:
- the given vertices for chaining, converted to world vertices
 
- 
toWorldVerticespublic static float[] toWorldVertices(float[] vertices, com.badlogic.gdx.physics.box2d.Body body)- See Also:
- toWorldVertices(float[], int, int, Body)
 
- 
toLocalVerticespublic static float[] toLocalVertices(float[] vertices, int offset, int length, com.badlogic.gdx.physics.box2d.Body body)- Parameters:
- vertices- the world vertices to convert to local vertices
- body- the Body in which local coordinate system to convert the vertices
- Returns:
- the given vertices for chaining, converted to local vertices
 
- 
toLocalVerticespublic static float[] toLocalVertices(float[] vertices, com.badlogic.gdx.physics.box2d.Body body)- See Also:
- toLocalVertices(float[], int, int, Body)
 
- 
equalspublic static boolean equals(com.badlogic.gdx.physics.box2d.Transform a, com.badlogic.gdx.physics.box2d.Transform b)- Returns:
- whether the two given Transforms valuesequal
- Since:
- 0.7.1
 
- 
equalspublic static boolean equals(com.badlogic.gdx.physics.box2d.MassData a, com.badlogic.gdx.physics.box2d.MassData b)- Returns:
- whether the two MassDatas values equal
- Since:
- 0.7.1
 
- 
equalspublic static boolean equals(com.badlogic.gdx.physics.box2d.Filter a, com.badlogic.gdx.physics.box2d.Filter b)- Returns:
- whether the two Filters values equal
- Since:
- 0.7.1
 
- 
setSensorpublic static void setSensor(com.badlogic.gdx.physics.box2d.Body body, boolean sensor)sets thesensor flagsof all of the given Body's Fixtures- Parameters:
- body- the- Bodywhich- Fixtures'sensor flags to set
- sensor- the parameter to pass to- Fixture.setSensor(boolean)
- See Also:
- Fixture.setSensor(boolean)
 
- 
destroyFixturespublic static void destroyFixtures(com.badlogic.gdx.physics.box2d.Body body)destroysall fixtures of the given body- Parameters:
- body- the body which fixtures to destroy
 
- 
destroyFixturespublic static void destroyFixtures(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Fixture> exclude)destroysall fixtures of the given body except the given ones- Parameters:
- exclude- the fixtures not to destroy
- body- the body which fixtures to destroy
 
- 
destroyFixturespublic static void destroyFixtures(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.physics.box2d.Fixture... exclude)- See Also:
- destroyFixtures(Body, Array)
 
- 
destroyFixturespublic static void destroyFixtures(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.physics.box2d.Fixture exclude)- See Also:
- destroyFixtures(Body, Array)
 
- 
resetpublic static com.badlogic.gdx.physics.box2d.BodyDef reset(com.badlogic.gdx.physics.box2d.BodyDef bodyDef)- Parameters:
- bodyDef- the BodyDef to reset to default values
- Returns:
- the given BodyDef for chaining
- Since:
- 0.9.1
 
- 
resetpublic static com.badlogic.gdx.physics.box2d.FixtureDef reset(com.badlogic.gdx.physics.box2d.FixtureDef fixtureDef)- Parameters:
- fixtureDef- the FixtureDef to reset to default values
- Returns:
- the given FixtureDef for chaining
- Since:
- 0.9.1
 
 
-