if (this.enabledAccumulator) {
this._accumulator += dt;
var FIXED_TIME_STEP = PhysicsManager.FIXED_TIME_STEP;
var MAX_ACCUMULATOR = PhysicsManager.MAX_ACCUMULATOR;
// max accumulator time to avoid spiral of death
if (this._accumulator > MAX_ACCUMULATOR) {
this._accumulator = MAX_ACCUMULATOR;
}
while (this._accumulator > FIXED_TIME_STEP) {
world.Step(FIXED_TIME_STEP, velocityIterations, positionIterations);
this._accumulator -= FIXED_TIME_STEP;
}
}
else {
var timeStep = 1/cc.game.config['frameRate'];
world.Step(timeStep, velocityIterations, positionIterations);
}
源码是这么写的 根据逻辑我只需要设置this.enabledAccumulator 为true
然后可以设置FIXED_TIME_STEP 的刷新时间
可是实际项目中
cc.director.getPhysicsManager().enabledAccumulator = true;
cc.PhysicsManager.FIXED_TIME_STEP = 1/60/3;
这么设置没有效果 也没有加速。 不知道为什么 求解