Skip to content

Commit

Permalink
#733 Updated the named bone reference for the face cam after migratio…
Browse files Browse the repository at this point in the history
…n to CC4.

Added more fault tolerance.
  • Loading branch information
koschke committed Aug 27, 2024
1 parent 846377a commit cea5155
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Assets/SEE/Tools/FaceCam/FaceCam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ public class FaceCam : NetworkBehaviour
/// </summary>
private const int maximumNetworkByteSize = 32768;

/// <summary>
/// The relative path to the bone of the face/nose of the player.
/// This will be used to position the FaceCam.
/// </summary>
private const string faceCamOrientationBone = "CC_Base_BoneRoot/CC_Base_Hip/CC_Base_Waist/CC_Base_Spine01/CC_Base_Spine02/CC_Base_NeckTwist01/CC_Base_NeckTwist02/CC_Base_Head/CC_Base_FacialBone/CC_Base_R_Eye";

/// <summary>
/// The webcam texture to mat helper from the WebCamTextureToMatHelperExample.
/// </summary>
Expand Down Expand Up @@ -304,9 +310,15 @@ private void Start()
// This is the size of the FaceCam at the start
transform.localScale = new Vector3(0.2f, 0.2f, -1); // z = -1 to face away from the player.

// For the location of the face of the player we use his nose. This makes
// For the location of the face of the player we use his right eye. This makes
// the FaceCam also aprox. centered to his face.
playersFace = transform.parent.Find("Root/Global/Position/Hips/LowerBack/Spine/Spine1/Neck/Head/NoseBase");
playersFace = transform.parent.Find(faceCamOrientationBone);
if (playersFace == null)
{
Debug.LogError($"[FaceCam.Start] Could not find the bone {faceCamOrientationBone}.\n");
enabled = false;
return;
}

Initialize();

Expand Down

0 comments on commit cea5155

Please sign in to comment.