private void OnFacesChanged(ARFacesChangedEventArgs obj) { logText.text = "# of faces: " + obj.updated.Count + "\n"; foreach (ARFace face in obj.updated) { mainId = face.trackableId; if (!faceAnimExports.ContainsKey(face.trackableId)) { var newFaceAnimExport = new FaceAnimExportEntity(); newFaceAnimExport.uvs = face.uvs.Select(uv => new MyVec2(uv)).ToList(); newFaceAnimExport.indices = face.indices.ToList(); newFaceAnimExport.keyframes = new List <AnimKeyframe>(); faceAnimExports.Add(face.trackableId, newFaceAnimExport); } var faceAnimExport = faceAnimExports[face.trackableId]; var keyframe = new AnimKeyframe { position = new float[] { face.transform.position.x, face.transform.position.y, face.transform.position.z }, rotation = new float[] { face.transform.rotation.x, face.transform.rotation.y, face.transform.rotation.z, face.transform.rotation.w }, vertices = face.vertices.Select(vert => new MyVec3(vert)).ToList() }; faceAnimExport.keyframes.Add(keyframe); //If recording record voice } }
void FacesChanged(ARFacesChangedEventArgs args) { if (args.updated != null && args.updated.Count > 0) { face = args.updated[0].gameObject; faceUI.transform.rotation = face.transform.rotation; faceUI.transform.position = face.transform.position + faceUIOffset; } }
private void ArFaceManager_facesChanged(ARFacesChangedEventArgs obj) { GameObject go; foreach (ARFace item in obj.added) { go = Instantiate(lazerEye, item.leftEye, false); go = Instantiate(lazerEye, item.rightEye, false); } }
void OnFaceChanged(ARFacesChangedEventArgs args) { if (args.updated == null | args.updated.Count == 0) { return; } var face = faceManager.TryGetFace(args.updated[0].trackableId); BakeTexture(face); }
private void OnFaceUpdate(ARFacesChangedEventArgs args) { if (args.added.Count > 0 && !faceObj) { faceObj = args.added[0].gameObject; } if (args.removed.Count > 0) { faceObj = null; } }
//on ar face update received private void OnFaceUpdate(ARFacesChangedEventArgs args) { if (args.added.Count > 0) { faceAdded = true; } if (args.removed.Count > 0) { faceRemoved = true; } }
void ARFaceManagerOnFacesChanged(ARFacesChangedEventArgs changedEvent) { foreach (var arFace in changedEvent.removed) { FaceRemoved(arFace); } foreach (var arFace in changedEvent.updated) { FaceUpdated(arFace); } foreach (var arFace in changedEvent.added) { FaceAdded(arFace); } }
void OnFaceChanged(ARFacesChangedEventArgs args) { var subsystem = faceManager.subsystem as ARKitFaceSubsystem; info = new ARKitRemotePacket.FaceInfo(); info.added = args.added.Select(face => ToARFace(face)).ToArray(); info.updated = args.updated.Select(face => ToARFace(face)).ToArray(); info.removed = args.removed.Select(face => (ARKitStream.Internal.TrackableId)face.trackableId).ToArray(); var meshes = new List <ARKitRemotePacket.FaceMesh>(); meshes.AddRange(args.added.Select(face => ToMesh(face, subsystem))); meshes.AddRange(args.updated.Select(face => ToMesh(face, subsystem))); // removed meshes are not needed // meshes.AddRange(args.removed.Select(face => ToMesh(face))); info.meshes = meshes.ToArray(); }
void OnFaceChanged(ARFacesChangedEventArgs args) { var face = args.updated[0]; var coeffients = GetCoefficients(face.trackableId, faceManager.subsystem); sb.Clear(); sb.AppendLine("Coefficients"); for (int i = 0; i < coeffients.Length; i++) { var c = coeffients[i]; sb.Append(c.blendShapeLocation.ToString()); sb.Append(" :\t"); sb.Append(c.coefficient); sb.AppendLine(); } label.text = sb.ToString(); }
private void OnFaceUpdate(ARFacesChangedEventArgs args) { //assign newly added ar face if (args.added.Count > 0) { Debug.Log("face added"); var faceObj = args.added[0].gameObject; m_face = faceObj.GetComponent <ARFace>(); } //unassign ar face when it's lost if (args.removed.Count > 0) { Debug.Log("face lost"); m_face = null; } GetMeshDataAndWriteJson(); }
void ARFaceManagerOnFacesChanged(ARFacesChangedEventArgs changedEvent) { foreach (var arFace in changedEvent.removed) { var trackableId = arFace.trackableId; m_TrackedFaces.TryGetValue(trackableId, out var arFoundationFace); arFace.ToARFoundationFace(m_ARFaceManager.subsystem, ref arFoundationFace); m_TrackedFaces.Remove(trackableId); RemoveFaceData(arFoundationFace); } foreach (var arFace in changedEvent.updated) { UpdateFaceData(GetOrAddFace(arFace)); } foreach (var arFace in changedEvent.added) { AddFaceData(GetOrAddFace(arFace)); } }
private void OnFaceUpdate(ARFacesChangedEventArgs args) { //assign newly added ar face if (args.added.Count > 0 && !write) { var faceObj = args.added[0].gameObject; m_face = faceObj.GetComponent <ARFace>(); } //unassign ar face when it's lost if (args.removed.Count > 0) { m_face = null; } if (recording) { GetMeshIndices(); } }
void OnFaceChanged(ARFacesChangedEventArgs args) { // Debug.Log($"Face Changed: {args}"); }