From 9954afdf899e46608429fb299dad546e29532c76 Mon Sep 17 00:00:00 2001 From: Takahiro Date: Tue, 1 May 2018 06:27:41 +0900 Subject: [PATCH] MMDPhysics minor optimization --- examples/js/animation/MMDPhysics.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/js/animation/MMDPhysics.js b/examples/js/animation/MMDPhysics.js index 56dd2358ff..5a17a34eab 100644 --- a/examples/js/animation/MMDPhysics.js +++ b/examples/js/animation/MMDPhysics.js @@ -814,9 +814,9 @@ THREE.MMDPhysics.RigidBody.prototype = { var helper = this.helper; var p = helper.allocThreeVector3(); var q = helper.allocThreeQuaternion(); + var s = helper.allocThreeVector3(); - this.bone.getWorldPosition( p ); - this.bone.getWorldQuaternion( q ); + this.bone.matrixWorld.decompose( p, q, s ); var tr = helper.allocTransform(); helper.setOriginFromThreeVector3( tr, p ); @@ -825,6 +825,7 @@ THREE.MMDPhysics.RigidBody.prototype = { var form = helper.multiplyTransforms( tr, this.boneOffsetForm ); helper.freeTransform( tr ); + helper.freeThreeVector3( s ); helper.freeThreeQuaternion( q ); helper.freeThreeVector3( p ); @@ -881,8 +882,6 @@ THREE.MMDPhysics.RigidBody.prototype = { updateBoneRotation: function () { - this.bone.updateMatrixWorld( true ); - var helper = this.helper; var tr = this.getWorldTransformForBone(); -- GitLab