Skip to content

Commit afd78c8

Browse files
authored
Merge pull request #13968 from takahirox/MMDPhysicsMinorOptimization
MMDPhysics minor optimization
2 parents 8c6280b + 9954afd commit afd78c8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

examples/js/animation/MMDPhysics.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,9 +814,9 @@ THREE.MMDPhysics.RigidBody.prototype = {
814814
var helper = this.helper;
815815
var p = helper.allocThreeVector3();
816816
var q = helper.allocThreeQuaternion();
817+
var s = helper.allocThreeVector3();
817818

818-
this.bone.getWorldPosition( p );
819-
this.bone.getWorldQuaternion( q );
819+
this.bone.matrixWorld.decompose( p, q, s );
820820

821821
var tr = helper.allocTransform();
822822
helper.setOriginFromThreeVector3( tr, p );
@@ -825,6 +825,7 @@ THREE.MMDPhysics.RigidBody.prototype = {
825825
var form = helper.multiplyTransforms( tr, this.boneOffsetForm );
826826

827827
helper.freeTransform( tr );
828+
helper.freeThreeVector3( s );
828829
helper.freeThreeQuaternion( q );
829830
helper.freeThreeVector3( p );
830831

@@ -881,8 +882,6 @@ THREE.MMDPhysics.RigidBody.prototype = {
881882

882883
updateBoneRotation: function () {
883884

884-
this.bone.updateMatrixWorld( true );
885-
886885
var helper = this.helper;
887886

888887
var tr = this.getWorldTransformForBone();

0 commit comments

Comments
 (0)