title: Change collisionBitMask and categoryBitMask sometimes error
body: <p>I setup 2 objects with physics body, I only want when I touch and drag 1 object, I can move it through another object, and when TouchesEnded, 2 shape will move, for not cover another shape.
  The problem is SOMETIMES, when TouchesEnded, 2 objects get cover another, sometimes not :(</p>
  
  <p>This is my code:</p>
  
  <pre><code>static const uint32_t objectCategory = 1 &lt;&lt; 0;
  static const uint32_t noCategory = 1 &lt;&lt; 1;
  
  
  -(id)initWithSize:(CGSize)size {
      if (self = [super initWithSize:size]) {
  [self addChild:object1];
  [self addChild:object2];
  }
  
  -(void)object1z
  {
  
      object1 = [SKSpriteNode spriteNodeWithImageNamed:@"object1"];
      object1.position = CGPointMake(width*6.5/8, height/2);
      CGFloat offsetX = object1.frame.size.width * object1.anchorPoint.x;
      CGFloat offsetY = object1.frame.size.height * object1.anchorPoint.y;
      CGMutablePathRef path = CGPathCreateMutable();
      CGPathMoveToPoint(path, NULL,  - offsetX, object1.frame.size.height - offsetY);
      CGPathAddLineToPoint(path, NULL,  - offsetX,  - offsetY);
      CGPathAddLineToPoint(path, NULL, object1.frame.size.height - offsetX, object1.frame.size.height - offsetY);
      CGPathCloseSubpath(path);
      object1.physicsBody = [SKPhysicsBody bodyWithPolygonFromPath:path];
      object1.physicsBody.allowsRotation = NO;
      object1.physicsBody.categoryBitMask = objectCategory;
      object1.physicsBody.collisionBitMask = objectCategory;
      object1.physicsBody.dynamic = YES;
      object1.physicsBody.usesPreciseCollisionDetection = YES;
      object1.physicsBody.restitution = 0;
  object1.name = @"object1";
  }
  
  -(void)object2z
  {
  
      object2 = [SKSpriteNode spriteNodeWithImageNamed:@"object2"];
      object2.position = CGPointMake(width*/8, height/2);
      CGFloat offsetX = object2.frame.size.width * object2.anchorPoint.x;
      CGFloat offsetY = object2.frame.size.height * object2.anchorPoint.y;
      CGMutablePathRef path = CGPathCreateMutable();
      CGPathMoveToPoint(path, NULL,  - offsetX, object2.frame.size.height - offsetY);
      CGPathAddLineToPoint(path, NULL,  - offsetX,  - offsetY);
      CGPathAddLineToPoint(path, NULL, object1.frame.size.height - offsetX, object1.frame.size.height - offsetY);
      CGPathCloseSubpath(path);
      object2.physicsBody = [SKPhysicsBody bodyWithPolygonFromPath:path];
      object2.physicsBody.allowsRotation = NO;
      object2.physicsBody.categoryBitMask = objectCategory;
      object2.physicsBody.collisionBitMask = objectCategory;
      object2.physicsBody.dynamic = YES;
      object2.physicsBody.usesPreciseCollisionDetection = YES;
      object2.physicsBody.restitution = 0;
  object2.name = @"object2";
  }
  
  -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
  
     for (UITouch *touch in touches) {
          CGPoint location = [touch locationInNode:self];
  SKNode *node;
  node = [self nodeAtPoint:location];
  if ([node.name isEqualToString:@"object1"]) {
          o1 = 1;
          o2 = 0;
      } else if ([node.name isEqualToString:@"object2"])
      {
          o2 = 1;
          o1 = 0;
  
      }
  }
  }
  
  - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
      UITouch *touch = [touches anyObject];
      CGPoint positionInScene = [touch locationInNode:self];
      CGPoint previousPosition = [touch previousLocationInNode:self];
  
      .CGPoint translation = CGPointMake(positionInScene.x - previousPosition.x, positionInScene.y - previousPosition.y);
  if (o2 ==1) {
      object2.physicsBody.categoryBitMask = noCategory;
      object2.physicsBody.collisionBitMask = noCategory;
      [object2 setPosition:CGPointMake(object2.position.x + translation.x, object2.position.y +translation.y)];
  }
  if (o1 ==1) {
      object1.physicsBody.categoryBitMask = noCategory;
      object1.physicsBody.collisionBitMask = noCategory;
      [object1 setPosition:CGPointMake(object1.position.x + translation.x, object1.position.y +translation.y)];
  }
      }
  
  -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
  {
          object1.physicsBody.categoryBitMask = objectCategory;
          object1.physicsBody.collisionBitMask = objectCategory;
          object2.physicsBody.categoryBitMask = objectCategory;
          object2.physicsBody.collisionBitMask = objectCategory;
  }
  </code></pre>