physicsBody contactDidBegin没被调用?

时间:2014-07-01 17:51:21

标签: ios sprite-kit skphysicsbody

在我的代码中,我设置了用于球和焊接精灵的物理实体。

这是ball sprites的physicsBody设置:

ball.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:10];
ball.physicsBody.affectedByGravity = NO;
ball.physicsBody.velocity = velocity;
ball.physicsBody.restitution = 1;
ball.physicsBody.friction = 0;
ball.physicsBody.categoryBitMask = ballCategory;
ball.physicsBody.collisionBitMask = ballCategory | barrierCategory | weldCategory | weldPointCategory;
ball.physicsBody.contactTestBitMask = weldingCategory;

这是焊接精灵的physicsBody设置:

weldRU = [SKSpriteNode spriteNodeWithColor:[UIColor redColor] size:CGSizeMake(2, 2)];
weldRU.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:weldRU.size];
//weldRU.physicsBody.dynamic = NO;
weldRU.physicsBody.affectedByGravity = NO;
weldRU.physicsBody.categoryBitMask = weldingCategory;
weldRU.physicsBody.collisionBitMask = 0;
weldRU.physicsBody.contactTestBitMask = ballCategory;
weldRU.physicsBody.usesPreciseCollisionDetection = YES;

在设置中我互相提供categoryBitMask&{39}和contactTestBitMask但是当这些实体联系时,联系覆盖方法永远不会被调用。焊接精灵确实在任何可能的接触时间都有动作,但物理身体始终存在。我错过了一些导致他们无法检测到联系的东西吗?

0 个答案:

没有答案