the basic problem is that the objets dont collide
start a chipmunk and add callback function , the callback is called but the collision is ignored
the init
Code: Select all
//chipmunk init
cpInitChipmunk();
cpSpace * space =cpSpaceNew();
//gravity
space->gravity=cpv(0,-100);
Code: Select all
static int collFunc(cpShape *a, cpShape *b, cpContact *contacts, int numContacts, cpFloat normal_coef, void *data)
{
printf("collision %d",numContacts);
fflush(stdout);
return 1;
}
basic floor
Code: Select all
//make the floor
body=cpBodyNew(1000.0, 1000.1);
shape=cpSegmentShapeNew(body, cpv(0,0), cpv(WINDOW_WIDTH,0), 2.0f);
shape->e = 1.0; shape->u = 1.0;
cpSpaceAddStaticShape(space, shape);
im working under debian and c++
y attach the source ,executable and script to compile
to compile is needed sdl and sdl image library