0
我目前使用此代碼來旋轉CCSprite(播放器)對象以面對最後一次觸摸。問題是這使得旋轉變得非常激動,並且看起來不太平滑。旋轉CCSprite以在Cocos2D中觸摸
CGPoint playerPos = [player position];
CGPoint diff = CGPointMake(currentPoint.x-lastPoint.x, currentPoint.y-lastPoint.y);
CGPoint playerNewPos = ccpAdd(playerPos, diff);
[player setRotation:-CC_RADIANS_TO_DEGREES(atan2(playerNewPos.y-playerPos.y, playerNewPos.x-playerPos.x))];
我怎樣才能讓這段代碼更流暢流暢?
我也嘗試使用CCRotateTo但它導致相同的問題。
在此先感謝
@Viktor Lexington謝謝你指出這一點。 –