Here's a section of the relevant code:
Code: Select all
struct Segment {
float *points;
cpShape *myshape[65];
};
typedef struct Segment Segment;
for (int s = midPoint-1; s <= midPoint+1 ; s++) {
for (int p = 0; p < noOfPointsPerSegment; p++) {
cpSpaceRemoveStaticShape(space, landSegments[s].myshape[p]);
cpVect b = cpv(d*50.0f, landSegments[s].points[p]*80.0f);
landSegments[s].myshape[p] = cpSegmentShapeNew(staticBody, a, b, 0.0f);
landSegments[s].myshape[p]->u = 1.0;
cpSpaceAddStaticShape(space, landSegments[s].myshape[p]);
a = b;
d++;
}
}
cpSpaceRehashStatic(space);