Missing getter

Discuss new features and future development.

Missing getter

Postby Mixel » Sun Jul 10, 2011 1:15 pm

Could a function for getting the segments in a polygon be added?
Mixel
 
Posts: 41
Joined: Mon Feb 14, 2011 7:10 am

Re: Missing getter

Postby slembcke » Mon Jul 11, 2011 12:53 pm

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.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm


Return to Features/Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron