I'm writing on a small programm that loads pictures from a folder and shows them in fullscreen. Now I want the pictures to be thrown around by the user like on photoshopexpress.com.
This is not my first chipmunk app but this time I'm facing a problem..
My testwindow is 1280x800.. the BoundingBoxes of the StaticShapes around the window look like this:
My Chipmunk init:(l, b, r, t)
-10 , -5 , 0 , 805
-5 , -10 , 1285 , 0
1280 , -5 , 1290 , 805
-5 , 800 , 1285 , 810
Code: Select all
cpInitChipmunk();
cpBody *staticBody;
staticBody = cpBodyNew(INFINITY, INFINITY);
space = cpSpaceNew();
space->elasticIterations = 10;
space->gravity = cpv(00, 100);
cpShape *shape;
cpSpaceResizeStaticHash(space, 30.0f, 1000);
cpSpaceResizeActiveHash(space, 30.0f, 1000);
Code: Select all
shape = cpSegmentShapeNew(staticBody, cpv(-5,0), cpv(-5,hge->System_GetState(HGE_SCREENHEIGHT)), 5.0f);
shape->e = 1.0; shape->u = 1.0;
shape->collision_type = 0;
shape->layers = NOT_GRABABLE_MASK;
cpSpaceAddStaticShape(space, shape);
Code: Select all
QList<cpBody*> picBodies;
Filling like this (shortened):
Code: Select all
for(int i = 0; i < picSprites.count(); ++i)
{
cpBody *tempBody;
tempBody = cpBodyNew(1.0f, 1.0f);
tempBody->p = cpv(posX, posY); //PosX and PosY hace automatically calculated values so the pictures fit into the Window
picBodies << tempBody;
// Now the shape from above
shape = cpSegmentShapeNew(cpSpaceAddBody(space, picBodies.last()), cpv(a1,a2), cpv(b1,b2), thick); //a1,a2,b1,b2 and thick are also automatically calculated
shape->e = 0.8; shape->u = 0.3;
shape->collision_type = 1;
cpSpaceAddShape(space, shape);
}
20 , 20 , 129.8 , 197.3
Anyways.. the picture flys through the staticShapes..
I've searched about 5h for the mistake but I didn't find any..
Have you got any ideas?
I can also post the full code with the automation code.. it's just that it contains QT stuff...