title: Reading nodes position after physics simulation
body: <p>So I'm trying to make an app where you pick up objects with your finger, it moves with your finger and then you flick it away to throw it. I found some threads for similar games but not with this particular problem.</p>
  
  <p>Since I couldn't really keep the object along with my finger by applying force or impulse I disable the physics on it while I'm "holding it", measure velocity so when I release it I apply that vector as an impulse.</p>
  
  <p>This works excellent visually but when I try to read the position of the object it's not synced up with "reality". I've made a condition so if velocity isn't strong enough when you release the object it is supposed to return to its starting position but it doesn't move at all (except if you manage to throw it, that works fine) so when I tried to output the .position to the console it didn't correlate to what I was seeing on the screen.</p>
  
  <p>Any ideas? I know you shouldn't set position and simulate physics at the same time but I disable the physics for when I'm dragging the object. Why won't it keep track of .position just because it is moving it with physics?</p>
  
  <p>Here I try to throw a potion:</p>
  
  <pre><code>- (void)handlePan:(UIPanGestureRecognizer *)recognizer {
      if (recognizer.state == UIGestureRecognizerStateBegan) {         //Picked up
  
          potion.physicsBody.dynamic = NO;
          potion.physicsBody.velocity = CGVectorMake(0.0, 0.0);
          potion.physicsBody.angularVelocity = 0.0;
          potion.zRotation = 0.0;
  
          CGPoint touchLocation = [recognizer locationInView:recognizer.view];
          touchLocation = [self convertPointFromView:touchLocation];
          [self selectNodeForTouch:touchLocation];
  
  
      } else if (recognizer.state == UIGestureRecognizerStateChanged) { //Moved around
  
          CGPoint translation = [recognizer translationInView:recognizer.view];
          translation = CGPointMake(translation.x, -translation.y);
          [self panForTranslation:translation];
          [recognizer setTranslation:CGPointZero inView:recognizer.view];
  
          velocity = CGVectorMake(translation.x, translation.y);
  
  
      } else if (recognizer.state == UIGestureRecognizerStateEnded) {   //Dropped
  
          _selectedNode = nil;
          potion.physicsBody.dynamic = YES;
  
          if (potion.position.y &lt; 250 &amp;&amp; velocity.dy &lt; 20) {            //Returned to starting position
  
              NSLog(@"Pos:%f,%f",potion.position.x,potion.position.y);
  
              potion.physicsBody.velocity = CGVectorMake(0.0, 0.0);
              potion.physicsBody.angularVelocity = 0.0;
              potion.zRotation = 0.0;
              potion.position = CGPointMake(gameWidth / 2, 150);
              NSLog(@"Returning potion");
              NSLog(@"Pos:%f,%f",potion.position.x,potion.position.y);
  
  
          } else {                                                       //Flung away
  
              [potion.physicsBody applyImpulse:velocity];
              NSLog(@"Add impulse: %f, %f", velocity.dx, velocity.dy);
              NSLog(@"Pos:%f,%f",potion.position.x,potion.position.y);
  
  
          }
  
      }
  }
  </code></pre>
  
  <p>EDIT:After some more testing I've observed that if it has never been thrown (dynamic with impulse) it always shows (160, 150) as its position no matter where it is. Sometimes it shows something like 160.00031 and I don't know why. After it has been thrown it shows the correct position in the NSLog but changing the position still doesn't work</p>
  
  <p>EDIT2: Just saw that it doesn't show the correct position after a throw. Just different but they seem offset. I throw objects in the +y direction (up) and when I put it down in the left corner the position.x is correct but position.y is offset by about 300. So where y should be 0 it's 300.</p>