[已解决]3.0Beta版,物理精灵运动的问题求助

在使用ChipMuck的情况下,PhysicsSprite是否只要设置速度他就可以自己运动,还是要在update方法里自己去刷新坐标,使他运动啊

setSpeed: function (speed) {
var radians = this.getSpeedRadians();
this._body.setVel(cp.v(speed * Math.cos(radians), speed * Math.sin(radians)));
},

在update里调用space的step方法,让Chipmunk每帧都运行物理仿真,从而刷新PhysicsSprite的状态。可以将dt分为几个step来提高精度,当然也不能过多。
update: function (dt) {
var steps = 2;
dt /= steps;
for (var i = 0; i < steps; i++) {
this.space.step(dt);
}
},

谢谢,楼上的回答,我明天试试