I want to know how to edit the FaceAnimManager.cs file to working like this.
-
4 people standing on camera.
-
put emojis on their face.
-
all emojis are different each other.
to make this work, I coppied (FaceAnimManger 1, 2, … 4) and edit 4 FaceAnimManger.cs file like this
void OnSkeletonUpdate(SkeletonData skeletonData)
{
string json = Nuitrack.GetInstancesJson();
faceInfo = JsonUtility.FromJson(json.Replace("""", “[]”));
if (faceInfo.Instances.Length == 0)
return;
for (int i = 0; i < faceAnimControllers.Count; i++)
{
if (i < skeletonData.Skeletons.Length)
{
Skeleton skeleton = skeletonData.GetSkeletonByID(faceInfo.Instances[i].id);
if(faceInfo.Instances[i].id == 1)
{
if (skeleton != null)
{
nuitrack.Joint headJoint = skeleton.GetJoint(JointType.Head);
faceAnimControllers[i].gameObject.SetActive(headJoint.Confidence > 0.7f);
faceAnimControllers[i].UpdateFace(faceInfo.Instances[i], headJoint);
}
}
}
else
{
faceAnimControllers[i].gameObject.SetActive(false);
}
}
}
}
changed number each scripts files.
if(faceInfo.Instances[i].id == 1 , 2, 3, 4)**
everythings looks fine but odd thing occured when this situation
step.1 person A standing on camera
step.2 person B get in to camera
setp.3 person A get out of camera
step.4 person A get in again
then serveral coppied emojis showing up on screen.
I don’t know how to fix this problem.
sorry for my poor ENG writting skills.