Alright, so I run through a nested for loop and create a grid of block objects (6 rows of 7 blocks). I then create a ball and for now I just drop it from the top of the screen. The physics and everything is working, the ball bounces around and destroys certain blocks on impact. But, when the ball comes to rest on top of a block, it then begins to slowly sink through the block.
I've noticed a direct relationship between the difference in the two objects' masses - the greater the difference the slower the sinking. However, I don't think objects should just be passing through others based on mass - but I could be wrong.
Here is bit of code for the blocks - (I had the block at about 20.0f but had to bring it to 900.0f or more to slow down the sinking)
Code: Select all
cpBody *body = cpBodyNew(900.0f, INFINITY);
body->p = CGPointMake(x, y);
cpShape *shape = cpPolyShapeNew(body, num, verts, CGPointZero);
shape->e = 0.5f; shape->u = 0.25f;
shape->data = sprite;
shape->group = 1;
shape->collision_type =type;
cpSpaceAddShape(space, shape);
Code: Select all
cpBody *ballBody = cpBodyNew(6.0f,cpMomentForCircle(3.0f, 9.5, 9.5, CGPointZero));
ballBody->p = point;
cpSpaceAddBody(space, ballBody);
cpShape* shape = cpCircleShapeNew(ballBody, 9.5, CGPointZero);
shape->e = .94f; shape->u = 0.08f;
shape->data = ballSprite;
shape->collision_type = kNone;
cpSpaceAddShape(space, shape);
Any help would be appreciated, as I couldn't find any similar posts on the board - (Anyone looking to make a quicksand effect, take the code above
