Cocos2d-js 跑酷游戏教程,发现的一个疑问?!

游戏教程中游戏人物是通过给精灵一个受力的Body让他不断移动。然后通过将Sprite加入到SpriteBatchNode中,进行渲染。同步在移动过程中移动游戏视图,从而达到相机捕捉的作用。

然后问题来了。新版中不是不提倡用SpriteBatchNode,…。然后我直接将Sprite加入到游戏Layer中,运行时发现body和sprite移动距离不同步~。
sprite的移动速度是body的两倍。

而加Sprite加入到SpriteBatchNode中时进行渲染时,整个过程又是正常的,不知道这两者中间到底出了什么问题~

var AnimationLayer = cc.Layer.extend({
spriteSheet: null,
runningAction: null,
sprite: null,
space:null,
body:null,
shape:null,

ctor:function (space) {
    this._super();
    this.space = space;
    this.init();

    this._debugNode = new cc.PhysicsDebugNode(this.space);
   // this._debugNode.setVisible(false);
    // Parallax ratio and offset
    this.addChild(this._debugNode, 10);
},
init:function () {
    this._super();

    // create sprite sheet
    cc.spriteFrameCache.addSpriteFrames(res.runner_plist);
    this.spriteSheet = new cc.SpriteBatchNode(res.runner_png);
   


    // init runningAction
    var animFrames = ];
    for (var i = 0; i < 8; i++) {
        var str = "runner" + i + ".png";
        var frame = cc.spriteFrameCache.getSpriteFrame(str);
        animFrames.push(frame);
    }

    var animation = new cc.Animation(animFrames, 0.1);
    this.runningAction = new cc.RepeatForever(new cc.Animate(animation));


    //create runner through physic engine
    this.sprite = new cc.PhysicsSprite("#runner0.png");
    var contentSize = this.sprite.getContentSize();
    // init body
    this.body = new cp.Body(1, cp.momentForBox(1, contentSize.width, contentSize.height));
    this.body.p = cc.p(g_runnerStartX, g_groundHeight + contentSize.height / 2);
    this.body.applyImpulse(cp.v(150, 0), cp.v(0, 0));//run speed
    this.space.addBody(this.body);
    //init shape
    this.shape = new cp.BoxShape(this.body, contentSize.width - 14, contentSize.height);
    this.space.addShape(this.shape);

    this.sprite.setBody(this.body);
    this.sprite.runAction(this.runningAction);


    //使用SpriteBatchNode,运行正常
    //this.addChild(this.spriteSheet);
   // this.spriteSheet.addChild(this.sprite);


    //直接使用Sprite,出现body和Sprite不同步,Sprite会跑出游戏场景之外
    this.addChild(this.sprite);


    this.scheduleUpdate();


},

getEyeX:function () {
    return this.sprite.getPositionX() - g_runnerStartX;
}

});

只要修改下跑酷游戏教程中AnimationLayer.js中的,跑酷人物Sprite的是否是直接加入到AnimationLayer还是先加入到SpriteBatchNode在将SpriteBatchNode加入到AnimationLayer就可以发现这个问题了。没人知道吗?
//使用SpriteBatchNode,运行正常
//this.addChild(this.spriteSheet);
// this.spriteSheet.addChild(this.sprite);

    //直接使用Sprite,出现body和Sprite不同步,Sprite会跑出游戏场景之外
    this.addChild(this.sprite);

问题还是木有解决~
问题点1:采用Sprite直接渲染,并且绑定物理引擎的刚体在视图做相对位移时就会出现 精灵速度出现加成,而刚体不变。
但是我在后端打印出的body,sprite,layer位置变化都是相同的,而实际的效果时sprite移动比两者都要快。
2.然后采用SpriteBatchNode就会一切正常;SpriteBatchNode渲染模式 和sprite是不是本质上有所不同。

3.http://www.cocos2d-x.org/docs/tutorial/framework/native/side-scrolling-the-background-in-box2d/zh
使用Cocos2d-x3.0和物理引擎制作滚动背景,原理都是相同的,貌似这个可以~

有木有了解这个的人,来解答一下。不一定要正确答案,给一个启发也可以啊