Collision bug in seg2poly
Posted: Sat Jan 26, 2013 12:49 pm
I've created a couple shapes which should collide with each other, but don't seem to. I may well be doing something wrong - but I've tried poking my code in a few different ways and it seems to always mess up the same.
Two shapes:
* A segment from -50,-100 to 50,100
* A box which is 300 wide, 100 tall centered around the origin
Somehow, they don't collide with each other. I've tried putting them on bodies in an updating space and so on, and I get the same behaviour. If the box is 200 wide instead, they collide correctly. (??)
Two shapes:
* A segment from -50,-100 to 50,100
* A box which is 300 wide, 100 tall centered around the origin
Somehow, they don't collide with each other. I've tried putting them on bodies in an updating space and so on, and I get the same behaviour. If the box is 200 wide instead, they collide correctly. (??)
Code: Select all
cpShape *seg = cpSegmentShapeNew(NULL, cpv(-50, -100), cpv(50, 100), 10);
cpShapeUpdate(seg, cpvzero, cpvforangle(0));
cpShape *poly = cpBoxShapeNew(NULL, 300, 100);
cpShapeUpdate(poly, cpvzero, cpvforangle(0));
cpContact c[100];
int num = cpCollideShapes(seg, poly, c);
printf("%d\n", num); // prints 0