Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88737

rotateTo 貌似不太对

$
0
0

@cocosine 写道:

如果我传了大于 360 的数给 rotateTo,动作效果就不对了
看了下引擎实现

/*
 * CCActionInterval.js
 */

startWithTarget:function (target) {
    cc.ActionInterval.prototype.startWithTarget.call(this, target);

    // Calculate X
    var locStartAngleX = target.rotationX % 360.0;
    var locDiffAngleX = this._dstAngleX - locStartAngleX;
    if (locDiffAngleX > 180)
        locDiffAngleX -= 360;
    if (locDiffAngleX < -180)
        locDiffAngleX += 360;
    this._startAngleX = locStartAngleX;
    this._diffAngleX = locDiffAngleX;

    // Calculate Y  It's duplicated from calculating X since the rotation wrap should be the same
    this._startAngleY = target.rotationY % 360.0;
    var locDiffAngleY = this._dstAngleY - this._startAngleY;
    if (locDiffAngleY > 180)
        locDiffAngleY -= 360;
    if (locDiffAngleY < -180)
        locDiffAngleY += 360;
    this._diffAngleY = locDiffAngleY;
},

那个 locDiffAngleX 是不是也应该 % 360.0

帖子: 2

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 88737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>