Page 1 of 1

Missing getter

Posted: Sun Jul 10, 2011 1:15 pm
by Mixel
Could a function for getting the segments in a polygon be added?

Re: Missing getter

Posted: Mon Jul 11, 2011 12:53 pm
by slembcke
The vertexes are all in order, you just get i and i+1.

Code: Select all

for(int i=0; i<count; i++){
	cpVect a = cpBodyLocal2World(body, cpPolyShapeGetVert(poly, i));
	cpVect b = cpBodyLocal2World(body, cpPolyShapeGetVert(poly, (i+1)%count);
	...
}
Chipmunk doesn't store the segments at all, having a function that could return them would require adding a segment struct or something like that that would only ever be used once.