title: Removing and adding children of a physics node
body: <p>I am writing a Cocos2d V3, chipmunk game, which involves loading in a ccbfile - a node -, and initializing its class, called redLight. I then add that ccbfile with a certain number of children to an overarching level node,  creat an array of redlight's, and then remove them as children of itself, and add them as children of the overarching level node. </p>
  
  <p><strong>When I remove a node and add it to another parent inside a physics body, its physics node's position is not transformed</strong></p>
  
  <p>I need to do this in order to make the redLight instance aware of its children, but add them to its parent so that any future positional calculations do not need to involve transforming the position of the children in its parent node (redLight) to its position in the overarching level node. </p>
  
  <p>The problem I am facing is that when I execute the following code, under debug draw, the light's positions are transformed to the overarching level node, but the physics bodies are not. The character is supposed to collide with the physics bodies and then execute an action, but since the physicsbodies don't transform their position, nothing useful happens.
  Here is my code:
  for (int i = 0; i &lt; [redLights count]; i++) {</p>
  
  <pre><code>    lightSource *switchLight = [redLights objectAtIndex:i];
      CGPoint diffPos = ccpAdd(switchLight.position, self.position);
      [self removeChild:switchLight cleanup:NO];
      switchLight.physicsBody = nil;
      switchLight.position = diffPos;
  //switchLight.physicsBody.absolutePosition = switchLight.position;
      switchLight.physicsBody = [CCPhysicsBody bodyWithCircleOfRadius:[switchLight          radius] andCenter:switchLight.position];
      switchLight.physicsBody.type = CCPhysicsBodyTypeStatic;
      [[[gameData sharedData].GamePlayNode level] addChild:switchLight];
  
      switchLight.physicsBody.collisionType = @"redLight";
  //switchLight.physicsBody.absolutePosition = switchLight.position;
        }
  </code></pre>
  
  <h3>I would appreciate help with this.</h3>
  
  <p><img src="https://i.stack.imgur.com/x5Azv.png" alt="With debug draw"></p>
  
  <p>Of course, closer to release date, I will completely update the graphics and make the UX more remarkable with more interactivity, but now, I am focusing on the core gameplay
  <img src="https://i.stack.imgur.com/5a0dY.png" alt="This is without debug draw."></p>