Missing getter

Discuss new features and future development.
Post Reply
Mixel
Posts: 41
Joined: Mon Feb 14, 2011 7:10 am
Contact:

Missing getter

Post by Mixel »

Could a function for getting the segments in a polygon be added?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Missing getter

Post 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.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests