is it possible to detect a contact and let the object pass the other ? Because I want to increase a variable when they pass each other.
I made both phyisicsbodies dynamic, then they pass but didBeginContact is not working anymore then.
Thanks
EDIT:
Okay , so everything is working when I don't have the bodies dynamic. I have a BottomEdgeBody which I use to detect when the raining stones passed my player and then it increases the Score. So, if nothing is dynamic, my stones stay on top of the bottomEdge but I want them to fall through it.
Some Code:
in didBeginContact
if(contact.bodyA.categoryBitMask == bottomEdgeCategory)
{
self.scoring = self.scoring +1;
[self.scoreLabel setText:[NSString stringWithFormat:@"Score: %ld", (long)self.scoring]];
}
if(contact.bodyB.categoryBitMask == bottomEdgeCategory)
{
self.scoring = self.scoring +1;
[self.scoreLabel setText:[NSString stringWithFormat:@"Score: %ld", (long)self.scoring]];
}
If i make stone.physicsBody.dynamic = NO; and same for the bottomEdge, they pass themselves but the score is not increased anymore.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…