@@ -172,11 +172,11 @@ public void ProcessAnimation(AnimationStream stream)
172172 if ( SpineCorrectionType != DeformationData . SpineTranslationCorrectionType . None &&
173173 ( ! CorrectSpineOnce || ( CorrectSpineOnce && ! _correctedSpine ) ) )
174174 {
175- ProcessSpineCorrection ( stream ) ;
175+ ProcessSpineCorrection ( stream , weight ) ;
176176 _correctedSpine = true ;
177177 }
178- ProcessDeformation ( stream ) ;
179- ProcessArms ( stream ) ;
178+ ProcessDeformation ( stream , weight ) ;
179+ ProcessArms ( stream , weight ) ;
180180 }
181181 else
182182 {
@@ -195,7 +195,7 @@ public void ProcessAnimation(AnimationStream stream)
195195 }
196196 }
197197
198- private void ProcessSpineCorrection ( AnimationStream stream )
198+ private void ProcessSpineCorrection ( AnimationStream stream , float weight )
199199 {
200200 var currentDirection = HipsToHeadBones [ HipsBonesIndex ] . GetPosition ( stream ) -
201201 HipsToHeadBones [ HeadBonesIndex ] . GetPosition ( stream ) ;
@@ -211,13 +211,13 @@ private void ProcessSpineCorrection(AnimationStream stream)
211211 }
212212
213213 var bone = HipsToHeadBones [ i ] ;
214- var targetPos = bone . GetPosition ( stream ) ;
215- bone . SetPosition ( stream , targetPos + offset ) ;
214+ var currentPosition = bone . GetPosition ( stream ) ;
215+ bone . SetPosition ( stream , Vector3 . Lerp ( currentPosition , currentPosition + offset , weight ) ) ;
216216 HipsToHeadBones [ i ] = bone ;
217217 }
218218 }
219219
220- private void ProcessDeformation ( AnimationStream stream )
220+ private void ProcessDeformation ( AnimationStream stream , float weight )
221221 {
222222 for ( int i = 0 ; i < StartBones . Length ; i ++ )
223223 {
@@ -246,20 +246,22 @@ private void ProcessDeformation(AnimationStream stream)
246246 {
247247 BonePositions [ i ] = targetPos ;
248248 }
249- EndBones [ i ] . SetPosition ( stream , BonePositions [ i ] ) ;
249+ EndBones [ i ] . SetPosition ( stream , Vector3 . Lerp ( startPos , BonePositions [ i ] , weight ) ) ;
250250 }
251251
252252 _initializedBonePositions = true ;
253253 }
254254
255- private void ProcessArms ( AnimationStream stream )
255+ private void ProcessArms ( AnimationStream stream , float weight )
256256 {
257257 var leftLowerArmPos = LeftLowerArmBone . GetPosition ( stream ) ;
258258 var rightLowerArmPos = RightLowerArmBone . GetPosition ( stream ) ;
259259 var leftArmOffset = LeftUpperArmBone . GetPosition ( stream ) - _originalLeftUpperArmPos ;
260260 var rightArmOffset = RightUpperArmBone . GetPosition ( stream ) - _originalRightUpperArmPos ;
261- LeftLowerArmBone . SetPosition ( stream , leftLowerArmPos + leftArmOffset * LeftArmOffsetWeight ) ;
262- RightLowerArmBone . SetPosition ( stream , rightLowerArmPos + rightArmOffset * RightArmOffsetWeight ) ;
261+ LeftLowerArmBone . SetPosition ( stream ,
262+ Vector3 . Lerp ( leftLowerArmPos , leftLowerArmPos + leftArmOffset * LeftArmOffsetWeight , weight ) ) ;
263+ RightLowerArmBone . SetPosition ( stream ,
264+ Vector3 . Lerp ( rightLowerArmPos , rightLowerArmPos + rightArmOffset * RightArmOffsetWeight , weight ) ) ;
263265 }
264266 }
265267
0 commit comments