修复bug。

This commit is contained in:
liteng 2018-08-17 07:38:54 +08:00
parent 98fb3167f1
commit d4e97f99b0
5 changed files with 11 additions and 13 deletions

View File

@ -25,7 +25,7 @@ function Physics(options) {
}
Physics.prototype.start = function () {
this.app.on(`animate.Physics`, this.update.bind(this));
// this.app.on(`animate.Physics`, this.update.bind(this));
};
/**
@ -84,9 +84,7 @@ Physics.prototype.createParalellepiped = function (sx, sy, sz, mass, pos, quat,
return threeObject;
};
Physics.prototype.update = function (clock) {
var deltaTime = clock.getDelta();
Physics.prototype.update = function (clock, deltaTime) {
this.world.stepSimulation(deltaTime, 10);
// Update rigid bodies

View File

@ -25,7 +25,9 @@ AnimateEvent.prototype.stop = function () {
AnimateEvent.prototype.onAnimate = function () {
this.app.editor.stats.begin();
this.app.call('animate', this, this.clock);
var deltaTime = this.clock.getDelta();
this.app.call('animate', this, this.clock, deltaTime);
this.app.call('render', this);
this.app.editor.stats.end();

View File

@ -65,8 +65,8 @@ AddMikuEvent.prototype.onAddMiku = function () {
});
};
AddMikuEvent.prototype.onAnimate = function (clock) {
this.helper.update(clock.getDelta());
AddMikuEvent.prototype.onAnimate = function (clock, deltaTime) {
this.helper.update(deltaTime);
this.effect.render(this.app.editor.scene, this.app.editor.camera);
};

View File

@ -78,11 +78,9 @@ AddPersonEvent.prototype.onObjectRemoved = function (object) {
}
};
AddPersonEvent.prototype.onAnimate = function (clock) {
var mixerUpdateDelta = clock.getDelta();
AddPersonEvent.prototype.onAnimate = function (clock, deltaTime) {
this.persons.forEach(function (person) {
person.mixer.update(mixerUpdateDelta);
person.mixer.update(deltaTime);
});
};

View File

@ -84,9 +84,9 @@ ParticleEmitterEvent.prototype.onObjectRemoved = function (object) {
}
};
ParticleEmitterEvent.prototype.onAnimate = function (clock) {
ParticleEmitterEvent.prototype.onAnimate = function (clock, deltaTime) {
this.groups.forEach((group) => {
group.tick(clock.getDelta());
group.tick(deltaTime);
});
};