I thought I’d try to use blender as a tool to draw physics shapes used in cocos2d, since it’s practically got everything you’d need for the job: good 3d tools; vertices; scriptable in python etc. etc. and after making this:

(the light gray area is a semi-transparent png used for reference)
I wrote small script that prints out the x/y positions of each of the vertices (I’ll include it here if you want to test it)
std::vector<Vec2> pts = {
Vec2(32.518404722213745, 58.081066608428955),
Vec2(43.27123761177063, 57.54342079162598),
Vec2(60.20730137825012, 65.87674617767334),
Vec2(75.79915523529053, 68.0275559425354),
Vec2(91.92895293235779, 72.8662371635437),
Vec2(107.67183303833008, 83.74323844909668),
Vec2(121.66688442230225, 100.84570646286011),
Vec2(130.253267288208, 122.99180030822754),
Vec2(133.74805450439453, 140.73420763015747),
Vec2(133.479106426239, 153.63761186599731),
Vec2(134.0165138244629, 160.62719821929932),
Vec2(139.86798524856567, 166.89422130584717),
Vec2(138.7926697731018, 171.19542360305786),
Vec2(135.0290298461914, 172.80877828598022),
Vec2(111.91021203994751, 174.42169189453125),
Vec2(114.5986557006836, 188.6688232421875),
Vec2(129.38368320465088, 189.4756555557251),
Vec2(138.52382898330688, 184.3677043914795),
Vec2(144.7065830230713, 180.33549785614014),
Vec2(150.35194158554077, 172.5395917892456),
Vec2(160.8363151550293, 168.50738525390625),
Vec2(165.0554656982422, 158.94253253936768),
Vec2(169.35659646987915, 140.93117713928223),
Vec2(165.0554656982422, 117.81235933303833),
Vec2(155.50761222839355, 91.25792980194092),
Vec2(145.02370357513428, 68.40780973434448),
Vec2(127.55024433135986, 53.08489799499512),
Vec2(111.44776344299316, 42.537662386894226),
Vec2(88.32874298095703, 37.16111183166504),
Vec2(55.80129623413086, 37.967449426651),
Vec2(42.93651878833771, 49.84023571014404),
Vec2(34.239304065704346, 49.627724289894104)
};
So far so good, but… then I used this data to make a PhysicsBody:
auto tstBodyNode = Sprite::create("images/banana.png");
auto tstBody = PhysicsBody::createPolygon(pts.data(), pts.size(), PHYSICSBODY_MATERIAL_DEFAULT, Vec2(-100,-100));
tstBody->setDynamic(false);
tstBodyNode->setPosition(org.x + screen.width * 0.5, screen.height * 0.5);
tstBodyNode->setPhysicsBody(tstBody);
addChild(tstBodyNode);
and this was the result:

It became a bit simplified… So, will the body need to be broken up into smaller shapes for this to work, or why do you think it ended up the way it did?

