por que a colisão não está funcionando, cocos2d v3?
eu crio um jogo simples como o flapy bird com cocos2d v3. Classe de interface:
@interface GameScene : CCScene<CCPhysicsCollisionDelegate>
// -----------------------------------------------------------------------
+ (GameScene *)scene;
- (id)init;
// -----------------------------------------------------------------------
@end
No arquivo .m:
_physicsWorld =[CCPhysicsNode node];
_physicsWorld.gravity=ccp(0, 0);
_physicsWorld.collisionDelegate=self;
_physicsWorld.debugDraw =YES;
[self addChild:_physicsWorld];
.........
bird.physicsBody=[CCPhysicsBody bodyWithRect:(CGRect){CGPointZero,bird.contentSize} cornerRadius:0];
bird.physicsBody.collisionGroup=@"birdGroup";
bird.physicsBody.collisionType=@"birdCollision";
[_physicsWorld addChild:bird];
........
tubeBody.physicsBody.collisionGroup =@"tubeGroup";
tubeBody.physicsBody.collisionType=@"tubeCollision";
tubeBody.physicsBody.type=CCPhysicsBodyTypeStatic;
[_physicsWorld addChild:tubeBody];
-(BOOL)ccPhysicsCollisionBegin:(CCPhysicsCollisionPair *)pair typeA:(CCNode *)nodeA typeB:(CCNode *)nodeB{
[self endGame];
NSLog(@"end game");
return YES;
}
por que o método ccPhysicsCollisionBegin nunca chama?