スプライトとタッチ ポイントの間の角度の計算に問題があるようです。ユーザーが画面に触れるたびに、スプライトがタッチポイントの方向を直接向くようにしようとしています。これが私のコードです:
-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
CGPoint tapPosition;
for (UITouch *touch in touches){
CGPoint location = [touch locationInView:[touch view]];
tapPosition = [self convertToNodeSpace:[[CCDirector sharedDirector] convertToGL:location]];
}
float angle = CC_RADIANS_TO_DEGREES(ccpAngle(fish.position, tapPosition));
[fish runAction:[CCRotateTo actionWithDuration:0.5 angle:angle]];
}
何か案は?ありがとう