I'm working on a game (with Cocos2d 3.0 and SpriteBuilder) in which a character smash another and gain impulse. To do this I'm trying the following:
-(BOOL)ccPhysicsCollisionPreSolve:(CCPhysicsCollisionPair *)pair hero:(CCNode *)hero goal:(CCNode *)goal {
[hero.physicsBody applyImpulse:ccp(0.0f, 9000)];
return TRUE;
}
And also:
-(void)ccPhysicsCollisionPostSolve:(CCPhysicsCollisionPair *)pair hero:(CCNode *)hero goal:(CCNode *)goal {
[hero.physicsBody applyImpulse:ccp(0.0f, 9000)];
}
But when the collision method is called, the character doesn't receive the impulse always. I also tried including the following inside "PostSolve" (How to make a dynamic body static in Cocos2d v3.0 with Chipmunk):
[[_physicsNode space] addPostStepBlock:^{
[hero.physicsBody applyImpulse:ccp(0.0f, 9000)];
} key:hero];
...but I have the same result. Do you hace any advice? Thank you.