Multipolygons
Last updated 13 June 2010
Multipolygons are used to create concave shapes. A multipolygon is just a list of vertices that ExtremePhysics will use to create multiple convex polygons.

A complex multipolygon
Creating a multipolygon is very similar to creating a normal polygon:
// this has to be done only once
ep_world_multipoly_begin(global.world,10);
ep_world_multipoly_set_vertex(global.world,0,10,10);
ep_world_multipoly_set_vertex(global.world,1,20,10);
ep_world_multipoly_set_vertex(global.world,2,20,20);
// ...
ep_world_multipoly_end(global.world,true);
poly_first = ep_world_multipoly_get_first(global.world);
poly_last = ep_world_multipoly_get_last(global.world);
The vertices should be defined in clockwise order and should not self-intersect.
Using the multipolygon is a bit more difficult, because there are actually multiple polygons.
for(i=poly_first;i<=poly_last;i+=1) {
shape = ep_shape_create_polygon(global.world,body,i,0,0,0,0.1);
ep_shape_set_collision(global.world,body,shape,1,1,0);
ep_shape_set_material(global.world,body,shape,0.2,0.5,0,0);
}