raj raj - 1 month ago 13
Android Question

How to use physics body editor's Loader to load fixture in Libgdx

sorry about this silly question, but i have no idea what do after creating body fixture from physics body editor software,aurelions ribbon. i don't know how to use loader, i just tried

BodyEditorLoader loader = new BodyEditorLoader(
Gdx.files.internal("data/player.json"));

// 1. Create a BodyDef, as usual.
BodyDef bd = new BodyDef();
bd.position.set(0, 0);
bd.type = BodyType.DynamicBody;

// 2. Create a FixtureDef, as usual.
FixtureDef fd = new FixtureDef();
fd.density = 1;
fd.friction = 0.5f;
fd.restitution = 0.3f;


but showing me error at line 1 BodyEditorLoader is unknown, and i don't know how to make it know to android studio,i am newbie please help me out.

Answer

Try adding this class to your project, (although there is a slight chance it might not work due to changes in the libGDX API but it should be fairly easy to use):

https://gist.github.com/grulg/8691e7ee7709367ce165