i have configured successfully Cocos2D and Chipmunk Pro.
But i have no idea, how make a sprite with physics.
Also i have not problems to define space, bodies, shapes etc.
Here is a code snippet:
Code: Select all
spriteTexture = [[CCTextureCache sharedTextureCache] addImage:@"Icon.png"];
float moment = cpMomentForBox(1.0f, self.contentSize.width, self.contentSize.height);
ChipmunkBody *body = [[ChipmunkBody alloc] initWithMass:1.0f andMoment:moment];
body.pos = ccp(120, 120);
body.data = spriteTexture;
[space add:body];
//row 1, col 1
int num = 0;
ChipmunkPolyShape *shape = [[ChipmunkPolyShape alloc] initWithBody:body count:num verts:NULL offset:CGPointZero];
shape.elasticity = 0.5f;
shape.friction = 0.5f;
[space add:shape];
Also i have implemented a update function.
Have someone a solution?
greeting linknik