public void Init(EyeDataReceiveModel eyeDataReceiveModel) { morphIndexDic.Add("rightEyeOpenessMorphName", meshRenderer.sharedMesh.GetBlendShapeIndex(rightEyeOpenessMorphName)); morphIndexDic.Add("leftEyeOpenessMorphName", meshRenderer.sharedMesh.GetBlendShapeIndex(leftEyeOpenessMorphName)); rightInitRotation = rightEyeBone.localRotation.eulerAngles; leftInitRotation = leftEyeBone.localRotation.eulerAngles; eyeDataReceiveModel.Register(eyeDataSubject); eyeDataSubject.Subscribe(receivedData => { rightEyeBone.localRotation = Quaternion.Euler(rightInitRotation + rightEyeBoneTransform.translateTransform( new Vector3(receivedData.RightEyeRotationY * intensity, receivedData.RightEyeRotationX * intensity, 0))); leftEyeBone.localRotation = Quaternion.Euler(leftInitRotation + leftEyeBoneTransform.translateTransform( new Vector3(receivedData.RightEyeRotationY * intensity, receivedData.RightEyeRotationX * intensity, 0))); meshRenderer.SetBlendShapeWeight(morphIndexDic["rightEyeOpenessMorphName"], 100 - (100 * receivedData.RightEyeOpeness)); meshRenderer.SetBlendShapeWeight(morphIndexDic["leftEyeOpenessMorphName"], 100 - (100 * receivedData.RightEyeOpeness)); }); }
public void Init(EyeDataReceiveModel eyeDataReceiveModel) { eyeDataReceiveModel.Register(eyeDataSubject); eyeDataSubject.Subscribe(receivedData => { Debug.Log("LeftX" + receivedData.LeftEyeRotationX + "LeftY" + receivedData.LeftEyeRotationY + "RightX" + receivedData.RightEyeRotationX + "RightY" + receivedData.RightEyeRotationY); }); }