2014-07-09 3 views
0

나는 간단한 대답이 있어야한다고 생각합니다. (아직 발견하지 못했습니다!) 내 SKScene에서 모든 노드가 배치되고 경로를 따라 올바르게 이동하지만 (왼쪽 하단의 원점을 기준으로) 사용자가이 좌표 (아래 코드)에서 터치 좌표를 수집하면 UIKit 원점을 기준으로 반환됩니다. 왼쪽 위). 나는 여기서 정말로 간단한 것을 놓치고 있다고 확신한다. 어떤 도움을 주시면 감사하겠습니다!Spritekit과 UIKit 좌표 간의 충돌

-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 

     UITouch *move=[[event allTouches] anyObject]; 
     CGPoint movepoint=[move locationInView:self.view]; 
     [_guide runAction:[SKAction moveTo:[[touches anyObject] locationInNode:self] duration:0.01 ]]; 

     if (recording){ 
      if (_MovePointsArray==NULL) { 
       _MovePointsArray=[[NSMutableArray alloc]init]; 
      } 
      [_MovePointsArray addObject:[NSValue valueWithCGPoint:movepoint]]; 
     } 
     curx=[NSString stringWithFormat:@"%f", movepoint.x]; 
     myXPos.text=curx; 
     cury=[NSString stringWithFormat:@"%f", movepoint.y]; 
     myYPos.text=cury; 
} 

답변

0

대체

CGPoint movepoint = [move locationInView:self.view]; 

- (CGPoint)locationInView:(UIView *)view 
- (CGPoint)locationInNode:(SKNode *)node 

CGPoint movepoint = [move locationInNode:self]; 

서명