您的位置:首页 > 移动开发 > Cocos引擎

cocos2d-x头像跟着轨迹移动关键代码

2013-11-09 21:46 253 查看
与kexinmei共同完成此文章

void RotateWithAction::step( float dt )
{
CCPoint prePos=pInnerTarget->getPosition();
pInnerAction->step(dt);
CCPoint curPos=pInnerTarget->getPosition();

float degree=atan2((curPos.x-prePos.x),(curPos.y-prePos.y));
degree=degree/3.14159f*180;

pInnerTarget->setRotation(degree);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: