0
_space = cpSpaceNew(); // setup the world in which the simulation takes place
_space->elasticIterations = _space->iterations;
_space->gravity = cpv(0.0f, GRAVITY); // initial gravity vector
CGSize size = [[self view] bounds].size;
//setup the 'edges' of our world so the bouncing balls don't move offscreen
cpBody *edge = cpBodyNewStatic();
cpShape *shape = NULL;
// left
shape = cpSegmentShapeNew(edge, cpvzero, cpv(0.0f, size.height-10), 0.0f);
shape->u = 0.1f; // minimal friction on the ground
shape->e = 0.7f;
cpSpaceAddStaticShape(_space, shape);
// a body can be represented by multiple shapes
// top
shape = cpSegmentShapeNew(edge, cpvzero, cpv(size.width-10, 0.0f), 0.0f);
shape->u = 0.1f;
shape->e = 0.7f;
cpSpaceAddStaticShape(_space, shape);
// right
shape = cpSegmentShapeNew(edge, cpv(size.width-10, 0.0f), cpv(size.width-10, size.height-10), 0.0f);
shape->u = 0.1f;
shape->e = 0.7f;
cpSpaceAddStaticShape(_space, shape);
// bottom
shape = cpSegmentShapeNew(edge, cpv(0.0f, size.height-10), cpv(size.width-10, size.height-10), 0.0f);
shape->u = 0.5f;
shape->e = 0.15f;
cpSpaceAddStaticShape(_space, shape);
화면을 사용하여 사각형 공간을 만들지 만 둥근 모양으로 만들고 싶습니다. 모든 제안을 환영합니다다람쥐 둥근 공간 만들기