@@ -7,6 +7,7 @@ const zeroVector = new THREE.Vector3();
77const upRotation = new THREE . Quaternion ( ) . setFromAxisAngle ( new THREE . Vector3 ( 1 , 0 , 0 ) , Math . PI / 2 ) ;
88const leftRotation = new THREE . Quaternion ( ) . setFromAxisAngle ( new THREE . Vector3 ( 0 , 1 , 0 ) , Math . PI / 2 ) ;
99const rightRotation = new THREE . Quaternion ( ) . setFromAxisAngle ( new THREE . Vector3 ( 0 , 1 , 0 ) , - Math . PI / 2 ) ;
10+ const z180Quaternion = new THREE . Quaternion ( ) . setFromAxisAngle ( new THREE . Vector3 ( 0 , 1 , 0 ) , Math . PI ) ;
1011
1112const localVector = new THREE . Vector3 ( ) ;
1213const localVector2 = new THREE . Vector3 ( ) ;
@@ -824,14 +825,10 @@ class Avatar {
824825 childHairBone . velocity . lerp ( zeroVector , 0.2 * timeDiff / 32 ) ;
825826
826827 const p2 = localVector5 . copy ( px ) . add ( childHairBone . velocity ) ;
827- const q2 = localQuaternion . multiplyQuaternions (
828- localQuaternion2 . setFromRotationMatrix ( localMatrix . lookAt (
829- zeroVector ,
830- hairDirection ,
831- localVector6 . set ( 0 , 0 , - 1 ) . applyQuaternion ( hipsRotation ) ,
832- ) ) ,
833- childHairBone . initialWorldQuaternion
834- ) ;
828+ const q2 = localQuaternion . copy ( childHairBone . initialWorldQuaternion ) . premultiply ( hipsRotation ) ;
829+ if ( this . flipZ ) {
830+ q2 . premultiply ( z180Quaternion ) ;
831+ }
835832 _getMatrixWorld ( childHairBone ) . compose ( p2 , q2 , scale ) ;
836833 }
837834 for ( let i = 0 ; i < children . length ; i ++ ) {
0 commit comments