提交 d2fb8f23 编写于 作者: M Mr.doob

Merge pull request #6703 from TatumCreative/SkinnedMesh-calculate-inverses

SkinnedMesh.bind calculates the skeleton inverses
...@@ -43,9 +43,6 @@ ...@@ -43,9 +43,6 @@
// Bind the skeleton to the mesh // Bind the skeleton to the mesh
mesh.bind( armSkeleton ); mesh.bind( armSkeleton );
// Update the inverse matrices in the skeleton to reflect the newly bound skeleton
armSkeleton.calculateInverses();
// Move the bones and manipulate the model // Move the bones and manipulate the model
armSkeleton.bones[ 0 ].rotation.x = -0.1; armSkeleton.bones[ 0 ].rotation.x = -0.1;
armSkeleton.bones[ 1 ].rotation.x = 0.2; armSkeleton.bones[ 1 ].rotation.x = 0.2;
......
...@@ -159,7 +159,6 @@ ...@@ -159,7 +159,6 @@
mesh.add( bones[ 0 ] ); mesh.add( bones[ 0 ] );
mesh.bind( skeleton ); mesh.bind( skeleton );
skeleton.calculateInverses();
skeletonHelper = new THREE.SkeletonHelper( mesh ); skeletonHelper = new THREE.SkeletonHelper( mesh );
skeletonHelper.material.linewidth = 2; skeletonHelper.material.linewidth = 2;
......
...@@ -1209,7 +1209,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) { ...@@ -1209,7 +1209,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
} }
} }
threeMesh.bind(new THREE.Skeleton(bones, boneInverses, false)); threeMesh.bind( new THREE.Skeleton( bones, boneInverses, false ), threeMesh.matrixWorld );
} }
if (threeMesh) { if (threeMesh) {
......
...@@ -60,7 +60,7 @@ THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) { ...@@ -60,7 +60,7 @@ THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) {
this.normalizeSkinWeights(); this.normalizeSkinWeights();
this.updateMatrixWorld( true ); this.updateMatrixWorld( true );
this.bind( new THREE.Skeleton( bones, undefined, useVertexTexture ) ); this.bind( new THREE.Skeleton( bones, undefined, useVertexTexture ), this.matrixWorld );
}; };
...@@ -75,6 +75,8 @@ THREE.SkinnedMesh.prototype.bind = function( skeleton, bindMatrix ) { ...@@ -75,6 +75,8 @@ THREE.SkinnedMesh.prototype.bind = function( skeleton, bindMatrix ) {
if ( bindMatrix === undefined ) { if ( bindMatrix === undefined ) {
this.updateMatrixWorld( true ); this.updateMatrixWorld( true );
this.skeleton.calculateInverses();
bindMatrix = this.matrixWorld; bindMatrix = this.matrixWorld;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册