Skip to content

Loads Box2D objects from XML files generated by physicseditor.de

Notifications You must be signed in to change notification settings

hi5dev/box2d_pexml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Box2D PhysicsEditor XML Parser

A Java library for parsing XML files generated by PhysicsEditor into LibGDX's Box2D objects.

Usage

Here's an example for loading a body from src/test/resources/bugs.xml:

// you need a Box2D world to add the body to
World world = new World(new Vector2(0, -10), true);

// you'll need to create the body definition - PhysicsEditor doesn't support
// setting these attributes
BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyDef.BodyType.DynamicBody;

// load the XML file
PEXML pexml = new PEXML(Gdx.files.internal("bugs.xml").file());

// create the body - this will also add it to the physics simulation
Body body = pexml.createBody("bug_0001", world, bodyDef, 1, 1);

About

Loads Box2D objects from XML files generated by physicseditor.de

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages