I need to implement contours detection function in my iOS game, which I'm writing using cocos2d 2.1 For example user will provide me an image(PNG transparent):
So, I need detect shape polygon points and create box2d body from them, and I will able to put this image to my box2d scene.
I expect to have on output NSMutableArray with arrays of points of each polygon detected on the image. Same do PhysicsEditor, here is result of it:
Here is also result using VertexHelper(shows wrong way of detection, as one polygon... ):
Also SpriteHelper but without detection of other parts of image
My question is: how can I do this? What way is better and faster? I was looking for a solution in google, however I can't find any that will fit my needs...
Finally done this by using Chipmunk Autogeometry feature. Work like a charm.
Just using https://github.com/slembcke/ConcaveSprite/blob/master/ConcaveSprite/ConcaveSprite.m I've saved my time...