From d4e97f99b0973600f75a98fdfa63d490b2b50325 Mon Sep 17 00:00:00 2001 From: liteng <930372551@qq.com> Date: Fri, 17 Aug 2018 07:38:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShadowEditor.Web/src/editor/Physics.js | 6 ++---- ShadowEditor.Web/src/event/AnimateEvent.js | 4 +++- ShadowEditor.Web/src/event/menu/animation/AddMikuEvent.js | 4 ++-- ShadowEditor.Web/src/event/menu/animation/AddPersonEvent.js | 6 ++---- .../src/event/menu/component/ParticleEmitterEvent.js | 4 ++-- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ShadowEditor.Web/src/editor/Physics.js b/ShadowEditor.Web/src/editor/Physics.js index 0b8245c2..68b04cff 100644 --- a/ShadowEditor.Web/src/editor/Physics.js +++ b/ShadowEditor.Web/src/editor/Physics.js @@ -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 diff --git a/ShadowEditor.Web/src/event/AnimateEvent.js b/ShadowEditor.Web/src/event/AnimateEvent.js index 9843d49e..127bc091 100644 --- a/ShadowEditor.Web/src/event/AnimateEvent.js +++ b/ShadowEditor.Web/src/event/AnimateEvent.js @@ -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(); diff --git a/ShadowEditor.Web/src/event/menu/animation/AddMikuEvent.js b/ShadowEditor.Web/src/event/menu/animation/AddMikuEvent.js index 2730f725..fb3115e4 100644 --- a/ShadowEditor.Web/src/event/menu/animation/AddMikuEvent.js +++ b/ShadowEditor.Web/src/event/menu/animation/AddMikuEvent.js @@ -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); }; diff --git a/ShadowEditor.Web/src/event/menu/animation/AddPersonEvent.js b/ShadowEditor.Web/src/event/menu/animation/AddPersonEvent.js index 4c483e91..973dd4af 100644 --- a/ShadowEditor.Web/src/event/menu/animation/AddPersonEvent.js +++ b/ShadowEditor.Web/src/event/menu/animation/AddPersonEvent.js @@ -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); }); }; diff --git a/ShadowEditor.Web/src/event/menu/component/ParticleEmitterEvent.js b/ShadowEditor.Web/src/event/menu/component/ParticleEmitterEvent.js index 69c18690..04eba01d 100644 --- a/ShadowEditor.Web/src/event/menu/component/ParticleEmitterEvent.js +++ b/ShadowEditor.Web/src/event/menu/component/ParticleEmitterEvent.js @@ -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); }); };