Quote:
In older post you had in mind to add saving/loading "decomposed" objects to your sandbox.
Using your sandbox as a convex editor would be very useful until the official Box2d 2.5 "Convex decomposition" routine.
A customisable Grid with snapping would be a nice addition too.
What's your plan about that "editor" ?
I'm actually not sure exactly what I had in mind but it's useful to save decomposed objects by storing their decomposed state so it does not have to be recalculated. It would just be a two-dimensional array (I would almost certainly just use a std::vector<std::vector< b2Vec2 > > for something like this) and a simple loop to put that data into a box2d body. This seems to me like something that the game designer has to take care of himself.
If you are talking about retrieving a convex decomposition of a shape that you want to export and use in your own program, etc, i'm surprised that there arent other, better tools out there that'll crank out a decomposition, since what I have here is just a quick-and-dirty, as fast as possible method. Put a couple printlines into the code?
Im pretty certain that my grid is in there and is adjustable, use the plus and minus numpad keys.
The editor was just something I threw together to draw polygons with. It would eventually merge into whatever my level editor would become although I am not sure if my game will have a need for (or even freely allow) lots of free-form concave shapes. I really have no plans to make some elaborate interface for the polygon drawing. The error checking is a little complex though, however this is partly because of the way I made holes and the main shape separate (which really only served to complicate things.. since it relaly doesnt matter which particular shape is the red one). In any case you are free to steal that code... Its in tool.h...