@@ -31,6 +31,9 @@ public Updater(UdpClient udpClient, ILogger logger, bool isLegacy, (bool, bool)
3131 private const float SmoothingFactor = 0.5f ;
3232 private ModuleState _moduleState ;
3333
34+ public float EyeGainX { get ; internal set ; } = 1.0f ;
35+ public float EyeGainY { get ; internal set ; } = 1.0f ;
36+
3437 public void Update ( ModuleState state )
3538 {
3639 if ( _udpClient == null )
@@ -81,20 +84,20 @@ private static float[] ParseData(byte[] data, bool isLegacy)
8184 return header . trackingType == 2 ? DataPacketHelpers . ByteArrayToStructure < DataPacket . DataPackBody > ( data , Marshal . SizeOf < DataPacket . DataPackHeader > ( ) ) . blendShapeWeight : [ ] ;
8285 }
8386
84- private static void UpdateEye ( float [ ] pShape )
87+ private void UpdateEye ( float [ ] pShape )
8588 {
8689 var eye = UnifiedTracking . Data . Eye ;
8790
8891 #region LeftEye
8992 eye . Left . Openness = 1f - pShape [ ( int ) BlendShape . Index . EyeBlink_L ] ;
90- eye . Left . Gaze . x = pShape [ ( int ) BlendShape . Index . EyeLookIn_L ] - pShape [ ( int ) BlendShape . Index . EyeLookOut_L ] ;
91- eye . Left . Gaze . y = pShape [ ( int ) BlendShape . Index . EyeLookUp_L ] - pShape [ ( int ) BlendShape . Index . EyeLookDown_L ] ;
93+ eye . Left . Gaze . x = ( pShape [ ( int ) BlendShape . Index . EyeLookIn_L ] - pShape [ ( int ) BlendShape . Index . EyeLookOut_L ] ) * EyeGainX ;
94+ eye . Left . Gaze . y = ( pShape [ ( int ) BlendShape . Index . EyeLookUp_L ] - pShape [ ( int ) BlendShape . Index . EyeLookDown_L ] ) * EyeGainY ;
9295 #endregion
9396
9497 #region RightEye
9598 eye . Right . Openness = 1f - pShape [ ( int ) BlendShape . Index . EyeBlink_R ] ;
96- eye . Right . Gaze . x = pShape [ ( int ) BlendShape . Index . EyeLookOut_R ] - pShape [ ( int ) BlendShape . Index . EyeLookIn_R ] ;
97- eye . Right . Gaze . y = pShape [ ( int ) BlendShape . Index . EyeLookUp_R ] - pShape [ ( int ) BlendShape . Index . EyeLookDown_R ] ;
99+ eye . Right . Gaze . x = ( pShape [ ( int ) BlendShape . Index . EyeLookOut_R ] - pShape [ ( int ) BlendShape . Index . EyeLookIn_R ] ) * EyeGainX ;
100+ eye . Right . Gaze . y = ( pShape [ ( int ) BlendShape . Index . EyeLookUp_R ] - pShape [ ( int ) BlendShape . Index . EyeLookDown_R ] ) * EyeGainY ;
98101 #endregion
99102
100103 #region Brow
@@ -111,8 +114,8 @@ private static void UpdateEye(float[] pShape)
111114 #region Eye
112115 SetParam ( pShape , BlendShape . Index . EyeSquint_L , UnifiedExpressions . EyeSquintLeft ) ;
113116 SetParam ( pShape , BlendShape . Index . EyeSquint_R , UnifiedExpressions . EyeSquintRight ) ;
114- SetParam ( pShape [ ( int ) BlendShape . Index . EyeWide_L ] / 0.5f , UnifiedExpressions . EyeWideLeft ) ; // 目を見開けるように補正
115- SetParam ( pShape [ ( int ) BlendShape . Index . EyeWide_R ] / 0.5f , UnifiedExpressions . EyeWideRight ) ; // 目を見開けるように補正
117+ SetParam ( pShape , BlendShape . Index . EyeWide_L , UnifiedExpressions . EyeWideLeft ) ;
118+ SetParam ( pShape , BlendShape . Index . EyeWide_R , UnifiedExpressions . EyeWideRight ) ;
116119 #endregion
117120 }
118121
0 commit comments