Hello,
I am trying this...
cpInitChipmunk();
cpResetShapeIdCounter();
//////
staticBody = cpBodyNew(INFINITY, INFINITY);
space = cpSpaceNew();
cpSpaceResizeStaticHash(space, 400.0f, 40);
cpSpaceResizeActiveHash(space, 100, 600);
space->gravity = ccp(0, -200);
space->elasticIterations = space->iterations;
.......
.
int xb=200,yb=200;
Sprite *block1=[Sprite spriteWithFile:@"block.png"];
[block1 setPosition:ccp(xb,yb)];
[self addChild:block1];
shape = cpSegmentShapeNew(staticBody, ccp(xb-84/2,yb+9/2), ccp(xb+84/2,yb+9/2), 0.0f);
shape->e = 1.0f; shape->u = 1.0f;
shape->data=block;
shape->collision_type=1;
cpSpaceAddStaticShape(space, shape);
then the image reaches at (0,0) points, and shape at (200,200) pixes,
so i am not attaching image with shape
int xb=200,yb=200;
Sprite *block1=[Sprite spriteWithFile:@"block.png"];
[block1 setPosition:ccp(xb,yb)];
[self addChild:block1];
block1.rotation=20;
shape = cpSegmentShapeNew(staticBody, ccp(xb-84/2,yb+9/2), ccp(xb+84/2,yb+9/2), 0.0f);
shape->e = 1.0f; shape->u = 1.0f;
shape->collision_type=1;
cpSpaceAddStaticShape(space, shape);
shape->body->a=20
The shape is at 0 angle..
How can we rotate static shape in Chipmunk?