I try to create a CCPhysicsBody with a cornerRadius but I can't make it work. Here my code :

CCSprite * player = [[CCSprite alloc] initWithImageNamed:@"ship.png"];
player.position  = ccp(200, 100);
player.physicsBody = [CCPhysicsBody bodyWithRect:(CGRect){CGPointZero, player.contentSize} 
                                    cornerRadius:5.0f]; 
player.physicsBody.collisionGroup = @"playerGroup";
player.physicsBody.collisionType  = @"playerCollision";
[physicsWorld addChild:player];

I tried several values (1, 30, 10.0f ....) without effect. When I use physicsWorld.debugDraw = YES; the corners are never rounded.

Am I missing something ?

Thanks.

有帮助吗?

解决方案

If you are using Cocos2d v3.0 it's not yet developed. In v3.1 it's neither included, maybe in future releases.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top