Page 1 of 1

Box2dJson loader fork now "working" with LibGDX

Posted: Tue Jul 28, 2015 10:03 am
by rileyrg
https://github.com/rileyrg/b2dJson

First pass at getting the b2d json loader working with libGDX b2d types.

A few things commented out where I couldnt see obvious libgdx structures to match but bodies and fixtures loading fine.

Re: Box2dJson loader fork now "working" with LibGDX

Posted: Tue Jul 28, 2015 8:35 pm
by iforce2d
This is excellent, thanks for sharing! :)
I've added it to the list of loader contributions.

Just a couple of points I noticed:
1. Since libgdx is using a more recent version of Box2D than JBox2d was ported from, it should be possible to get gear and wheel joints working (those sections are there but commented out).
2. It looks like some automatic text replacement was used to change the type "Vec2" used by JBox2d for the "Vector2" type used by libgdx. This has unfortunately also changed occurrences of the "vec2" type used in RUBE custom properties. For example, the "vec2" in places like this should remain unchanged:

Code: Select all

if (propValue.has("vec2"))
    setCustomVector(item, propertyName, this.jsonToVec("vec2", propValue));
As it is now, the following will never find any custom vector properties:

Code: Select all

if (propValue.has("Vector2"))
    setCustomVector(item, propertyName, this.jsonToVec("Vector2", propValue));
Ideally, variable names that refer to the RUBE vec2 type should also remain unchanged, (eg. m_customPropertyMap_vec2).

Re: Box2dJson loader fork now "working" with LibGDX

Posted: Wed Jul 29, 2015 7:59 am
by rileyrg
Thanks for looking over. I'll address those things in the coming days.

Re: Box2dJson loader fork now "working" with LibGDX

Posted: Sun Oct 25, 2015 1:27 am
by sysex
hi! That's cool! I use libGdx and to load the scenes i use the
http://github.com/tescott/RubeLoader
and spend some time to get used to it.

I'm curious what is your loader doing specifically ? Sorry I'm new to Rube and confused which one I should take.

Thanks