Missing getter
-
- Posts: 41
- Joined: Mon Feb 14, 2011 7:10 am
- Contact:
Missing getter
Could a function for getting the segments in a polygon be added?
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Missing getter
The vertexes are all in order, you just get i and i+1.
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.
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);
...
}
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 2 guests