Box2DUtils: size, position, ... of Body, Fixture, Shape

Any community contributions to libgdx go here! Some may get included in the core API when permission is granted.

Box2DUtils: size, position, ... of Body, Fixture, Shape

Postby dermetfan » Sat May 25, 2013 1:54 pm

Hey,
I made a class called Box2DUtils that I use to get information like the size, position, vertices and max/min x/y from Bodies, Fixtures and Shapes. With this information, it's way easier to draw Textures at the correct position of the Body/its Fixture.
I didn't test everything completely, but I think it should work. If you find any errors or have ideas to make it better, I'd like to hear them.

You can find the class on Bitbucket.
You can find an usage example here: FixtureSprite - easily draw Sprites on Fixtures (source).

--------------------------------
This is part of libgdx-utils.

Last edited by dermetfan on Fri Jul 26, 2013 12:12 am, edited 18 times in total.
dermetfan
 
Posts: 375
Joined: Fri May 03, 2013 8:57 pm

Re: Box2DUtils class: get size, position, vertices

Postby imagnity » Sat May 25, 2013 4:00 pm

I don't know why but get/set scare me.
Check out my games - http://www.imagnity.com/games/
imagnity
 
Posts: 191
Joined: Mon Mar 25, 2013 6:27 pm

Re: Box2DUtils: size, position, ... of Body, Fixture, Shape

Postby dermetfan » Mon May 27, 2013 12:32 pm

That's bad, because this only contains get methods :p
Anyway, I think I fixed all the bugs, at least I fixed all I found, it should now be safe to use. :)
dermetfan
 
Posts: 375
Joined: Fri May 03, 2013 8:57 pm

Re: Box2DUtils: size, position, ... of Body, Fixture, Shape

Postby just4phil » Mon May 27, 2013 6:55 pm

thanks a lot for sharing your code!!
dont know when/where i will need this but maybe it will be helpful because my game bubblr is box2d-heavy ;)

bye
phil
just4phil
 
Posts: 858
Joined: Fri Feb 03, 2012 10:07 pm
Location: Berlin

Re: Box2DUtils: size, position, ... of Body, Fixture, Shape

Postby jrenner » Wed Jun 19, 2013 8:28 am

Thanks, this sounds useful.
Superior Tactics - tactical spaceship battles RTS
Google Play: https://play.google.com/store/apps/deta ... r.superior
jrenner
 
Posts: 481
Joined: Sun Apr 14, 2013 5:09 am


Return to Libgdx Contributions

Who is online

Users browsing this forum: Google Feedfetcher and 2 guests