Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Unity_OculusLipsync+Openface/Assets/Scripts/FaceAnimator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ private void Update()
curFrameBlendshapeVals = new Dictionary<int, float>();
// Deal with the timestamps, head + eye positions and rots, etc.

Vector3 headRot = new Vector3(frameData.d[4] * Mathf.Rad2Deg,
-frameData.d[5] * Mathf.Rad2Deg,
0);//frameData.d[6] * Mathf.Rad2Deg
float headRotCorrection = 0;
head_bone.transform.localRotation = Quaternion.Slerp(head_bone.transform.localRotation, Quaternion.Euler((headRot * headRotationMultiplier) + new Vector3(headRotCorrection, 0, 0)), Time.deltaTime * headRotationSpeed);
Vector3 headRot = new Vector3(frameData.d[3] * Mathf.Rad2Deg, // Represents Up/down in OpenFace
frameData.d[4] * Mathf.Rad2Deg, // Turn
frameData.d[5] * Mathf.Rad2Deg); // Tilt
// Convert world corrdinate of `headRot` into local one, using `head_bone`
Vector3 headRotLocal = head_bone.transform.InverseTransformDirection(headRot);
head_bone.transform.localRotation = Quaternion.Slerp(head_bone.transform.localRotation,
Quaternion.Euler(headRotLocal),
Time.deltaTime * headRotationSpeed);


foreach (var blend in overallBlendshapes)
Expand Down