In IOS 7 with SpriteKit how do you remove a physics body only but leave the node in the scene? I am trying to allow a collision to happen and then have the car actor smash through the obstacle wall.
for (SKSpriteNode *node in _obstacles)
{
node.position = CGPointMake(node.position.x - 2, node.position.y);
if( [_car intersectsNode: node] && node.physicsBody.collisionBitMask == 0)
{
NSLog(@"We have a hit!");
_lives--;
//prevent simultaneous hit
node.physicsBody.collisionBitMask = 1;
node.physicsBody.contactTestBitMask = 1;
node.physicsBody.dynamic = NO;
node.physicsBody = nil;
// [removeRequired addObject:node];
//flash the car to show momentary invuln
if(_lives <= 0)
{
_gameOver = YES;
}
}
else if( (node.position.x + (node.size.width / 2)) < 0)
{
[removeRequired addObject:node];
}
}
But the removal doesnt seem to be respected. I can see multiple hits occuring (for reference this code is called from the update method.