i wanna dis-activate the physic of node for a while .Please help me figure that out .
SKSpriteNode * node = [SKSpriteNode spriteNodeWithImageNamed:@"blade.png"];
node.size = CGSizeMake(30, 30);
node.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:node.size];
node.physicsBody.dynamic = YES;
node.physicsBody.collisionBitMask = CharacterCategory;
node.physicsBody.categoryBitMask = ObjectCategory;
node.physicsBody.contactTestBitMask = CharacterCategory;
node.position = nd.Position;
node.physicsBody.mass = 10000;
SKAction * actfadein = [SKAction fadeInWithDuration:nd.FadeInDuration];
SKAction * actfadeout = [SKAction fadeOutWithDuration:nd.FadeOutDuration];
SKAction * wait = [SKAction waitForDuration:3];
SKAction * removephy = [SKAction runBlock:^(void){
// i tried to removeFromParent but it never comes back
}];
SKAction * activatephy = [SKAction runBlock:^(void){
//[self addChild:node];
}];
SKAction * myActions = [SKAction sequence:@[actfadeout,removephy,wait,activatephy,actfadein]];
[node runAction:[SKAction repeatActionForever:myActions]];
[FadeObjects addChild:node];
Just set the physicsBody
property of the SKSpriteNode
to nil. If you later need to apply physics again, just assign another physicsBody
.