I,m trying basically a rectangle with a hole in the new framework provided by apple, the only problem is that it the default method bodyWithPolygonFromPath does not accept concave polygons, so I tried to approach the problem as follows:
CGPathMoveToPoint (path, NULL, self.size.width/4.0, self.size.height/4.0);
CGPathAddLineToPoint(path, NULL, self.size.width/2.0, -self.size.height/4.0);
CGPathAddLineToPoint(path, NULL, -self.size.width/2.0, -self.size.height/4.0);
CGPathAddLineToPoint(path, NULL, -self.size.width/2.0, self.size.height/4.0);
CGPathCloseSubpath (path);
self.physicsBody = [SKPhysicsBody bodyWithPolygonFromPath:path];
self.physicsBody.affectedByGravity = YES;
self.physicsBody.categoryBitMask = solidCategory;
self.physicsBody.dynamic = YES;
[self addChild:shape1];
self.auxiliaryShapeNode = [[SKSpriteNode alloc] init];
CGPathMoveToPoint (path_aux, NULL, 3*self.size.width/8.0, 0);
CGPathAddLineToPoint(path_aux, NULL, self.size.width/2.0, 1.5*self.size.height/4.0);
CGPathAddLineToPoint(path_aux, NULL, self.size.width/2.0, -self.size.height/4.0);
CGPathCloseSubpath (path_aux);
self.auxiliaryShapeNode.anchorPoint = CGPointMake(-3.0, 1.0/2.5);
self.auxiliaryShapeNode.physicsBody = [SKPhysicsBody bodyWithPolygonFromPath:path_aux];
self.auxiliaryShapeNode.physicsBody.dynamic = YES;
self.auxiliaryShapeNode.physicsBody.categoryBitMask = solidCategory;
[self addChild:self.auxiliaryShapeNode];
[self.scene.physicsWorld addJoint:[SKPhysicsJointFixed jointWithBodyA:self.physicsBody bodyB:self.auxiliaryShapeNode.physicsBody anchor:self.position]];
break;
where self is a custom sprite node i created which has a SKSprite node as auxiliary body shape so the shape can be made by two convex polygons, the it creates the shapes as it is supposed to, but when the scene starts playing the joint doesn't work as it is supposed to and moves the little triangle way off where it started