From cea5155f491b7fffc6d877bf769ca9df20466d37 Mon Sep 17 00:00:00 2001 From: Rainer Koschke Date: Tue, 27 Aug 2024 20:58:02 +0200 Subject: [PATCH] #733 Updated the named bone reference for the face cam after migration to CC4. Added more fault tolerance. --- Assets/SEE/Tools/FaceCam/FaceCam.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Assets/SEE/Tools/FaceCam/FaceCam.cs b/Assets/SEE/Tools/FaceCam/FaceCam.cs index 2464b9e5e4..cd793e3a2a 100644 --- a/Assets/SEE/Tools/FaceCam/FaceCam.cs +++ b/Assets/SEE/Tools/FaceCam/FaceCam.cs @@ -117,6 +117,12 @@ public class FaceCam : NetworkBehaviour /// private const int maximumNetworkByteSize = 32768; + /// + /// The relative path to the bone of the face/nose of the player. + /// This will be used to position the FaceCam. + /// + 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"; + /// /// The webcam texture to mat helper from the WebCamTextureToMatHelperExample. /// @@ -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();