@@ -49,7 +49,16 @@ public struct RetargetingAnimationJob : IWeightedAnimationJob
4949        /// <inheritdoc /> 
5050        public  void  ProcessRootMotion ( AnimationStream  stream ) 
5151        { 
52-             // Not applicable to retargeting. For now. 
52+             float  weight  =  jobWeight . Get ( stream ) ; 
53+             // Update hips for root motion. 
54+             if  ( weight  >  0f ) 
55+             { 
56+                 UpdateTargetTransform ( stream ,  0 ,  weight ) ; 
57+             } 
58+             else 
59+             { 
60+                 AnimationRuntimeUtils . PassThrough ( stream ,  TargetTransforms [ 0 ] ) ; 
61+             } 
5362        } 
5463
5564        /// <inheritdoc /> 
@@ -60,30 +69,7 @@ public void ProcessAnimation(AnimationStream stream)
6069            { 
6170                for  ( int  i  =  0 ;  i  <  TargetTransforms . Length ;  ++ i ) 
6271                { 
63-                     var  targetTransform  =  TargetTransforms [ i ] ; 
64-                     var  sourceTransform  =  SourceTransforms [ i ] ; 
65- 
66-                     if  ( ShouldUpdateRotation [ i ] ) 
67-                     { 
68-                         var  rotationOffset  =  RotationOffsets [ i ] ; 
69-                         var  rotationAdjustment  =  RotationAdjustments [ i ] ; 
70-                         var  originalRotation  =  sourceTransform . GetRotation ( stream ) ; 
71-                         var  finalRotation  =  originalRotation  *  rotationOffset  *  rotationAdjustment ; 
72-                         targetTransform . SetRotation ( stream , 
73-                            Quaternion . Slerp ( targetTransform . GetRotation ( stream ) ,  finalRotation ,  weight ) ) ; 
74-                     } 
75- 
76-                     if  ( ShouldUpdatePosition [ i ] ) 
77-                     { 
78-                         var  originalPosition  =  targetTransform . GetPosition ( stream ) ; 
79-                         var  finalPosition  =  sourceTransform . GetPosition ( stream ) ; 
80-                         targetTransform . SetPosition ( stream , 
81-                             Vector3 . Lerp ( originalPosition ,  finalPosition ,  weight ) ) ; 
82-                     } 
83- 
84-                     // update handles with binding info 
85-                     SourceTransforms [ i ]  =  sourceTransform ; 
86-                     TargetTransforms [ i ]  =  targetTransform ; 
72+                     UpdateTargetTransform ( stream ,  i ,  weight ) ; 
8773                } 
8874            } 
8975            else 
@@ -94,6 +80,34 @@ public void ProcessAnimation(AnimationStream stream)
9480                } 
9581            } 
9682        } 
83+ 
84+         private  void  UpdateTargetTransform ( AnimationStream  stream ,  int  i ,  float  weight ) 
85+         { 
86+             var  targetTransform  =  TargetTransforms [ i ] ; 
87+             var  sourceTransform  =  SourceTransforms [ i ] ; 
88+ 
89+             if  ( ShouldUpdateRotation [ i ] ) 
90+             { 
91+                 var  rotationOffset  =  RotationOffsets [ i ] ; 
92+                 var  rotationAdjustment  =  RotationAdjustments [ i ] ; 
93+                 var  originalRotation  =  sourceTransform . GetRotation ( stream ) ; 
94+                 var  finalRotation  =  originalRotation  *  rotationOffset  *  rotationAdjustment ; 
95+                 targetTransform . SetRotation ( stream , 
96+                    Quaternion . Slerp ( targetTransform . GetRotation ( stream ) ,  finalRotation ,  weight ) ) ; 
97+             } 
98+ 
99+             if  ( ShouldUpdatePosition [ i ] ) 
100+             { 
101+                 var  originalPosition  =  targetTransform . GetPosition ( stream ) ; 
102+                 var  finalPosition  =  sourceTransform . GetPosition ( stream ) ; 
103+                 targetTransform . SetPosition ( stream , 
104+                     Vector3 . Lerp ( originalPosition ,  finalPosition ,  weight ) ) ; 
105+             } 
106+ 
107+             // update handles with binding info 
108+             SourceTransforms [ i ]  =  sourceTransform ; 
109+             TargetTransforms [ i ]  =  targetTransform ; 
110+         } 
97111    } 
98112
99113    /// <summary> 
0 commit comments