Cocos2d iphone 如何在COCOS2D2D 3.2中找到多个触摸的位置?

Cocos2d iphone 如何在COCOS2D2D 3.2中找到多个触摸的位置?,cocos2d-iphone,Cocos2d Iphone,我想得到两个手指在CGPoint视图中的位置 我怎样才能从CCTouchEvent中得到它 到目前为止,我已经尝试过: -(void)touchMoved:(CCTouch *)touch withEvent:(CCTouchEvent *)event{ if ([[event allTouches] count]==2) { NSLog(@"Detected"); NSLog(@"event: %@",event.allTouches); }

我想得到两个手指在CGPoint视图中的位置

我怎样才能从CCTouchEvent中得到它

到目前为止,我已经尝试过:

-(void)touchMoved:(CCTouch *)touch withEvent:(CCTouchEvent *)event{

    if ([[event allTouches] count]==2) {

       NSLog(@"Detected");
       NSLog(@"event: %@",event.allTouches);

    }

}
您需要尝试以下方法: 第一个参数不再是CCTouch,它需要设置为

-(void)ccTouchesBegan:(NSSet *)touches withEvent:(CCTouchEvent *)event{
    for(CCTouch* touch in touches){
        [touch getLocation];
    }
}

通过枚举AllTouchs的值:

-(void)touchMoved:(CCTouch *)touch withEvent:(CCTouchEvent *)event{

if ([[event allTouches] count]==2) {


    CGPoint fingerOne = [event.allTouches.allValues[0] locationInWorld];
    CGPoint fingerTwo = [event.allTouches.allValues[1] locationInWorld];

    NSLog(@"fingerOne: x = %f, y = %f",fingerOne.x,fingerOne.y);
    NSLog(@"fingerTwo: x = %f, y = %f",fingerTwo.x,fingerTwo.y);


 }

}

CGPoint location=event.alltouchs[0]。locationInWorldsee此引用@AlexanderTkachenko此操作不起作用。。。AllTouchs是NSMutableDictionary而不是数组,因此如果它是dictionaryCGPoint location=event.AllTouchs.allValues[0].locationInWorld,则枚举dictionary的值