It should be… but there is no such function:
var verts = [40,0,0,0,0,20, 40,20];
var shape = new cp.PolyShape(body, verts,pos);
shape.setElasticity( 0.5 );
shape.setFriction( 0.5 );
cc.log(shape.setVerts); // logs "undefined"*
Maybe in another port of Chipmunk? I’m using the version of Chipmunk provided with Cocos2d-x-2.2.1 (I’m developing on Eclipse/ADT and testing on Android device). Maybe unsafe.h was not ported on this version (or maybe there is just no appropriate js-binding to these functions)?
I found some other port, maybe I’ll copy function from there:
PolyShape.prototype.setVerts = function(verts, offset)
....
....
https://github.com/andyque/Cocos2DTags/blob/master/cocos2d-html5/chipmunk/chipmunk.js
altought it would be a JavaScript-side solution so it would be slower than C/C++ solution (If I am not wrong, JavaScript in Cocos2D-x is used only as a scripting language/adapter and critical things like rendering, physics etc. are done on the C++/NDK side, right?)
I’ve read also about autogeometry feature in Chipmunk which could be helpful, but I can’t use that because afaik it is available only in Chipmunk Pro (I’m using the free version).