void UpdateCalibrationState() { CheckIfFaceIsDetected(); CheckIfPTSimpleIsConnected(); if ((calibrationState == 1) && (faceDetected == true)) { calibrationState = 3; backgroundImage.sprite = calibration3; Color c = backgroundImage.color; c.a = 0.5f; backgroundImage.color = c; } if ((calibrationState == 3) && (ptSimpleConnected == true)) { PTCToCBridge.CallSendPTSimpleMessage("centerCalibration"); calibrationState = 5; backgroundImage.sprite = calibration5; StartCalibrationTimer(); } if ((calibrationState == 5) && (calibrationTimer > 5.0f) && (hasCalibratedCenter == true)) { GameObject imageObject = backgroundImage.gameObject; imageObject.SetActive(false); isCalibrating = false; calibrationState = 0; } }
//*********** INIT ***********// void Start() { // Set the target frame rate to be 60FPS Application.targetFrameRate = 60; // Initialize the bridge between Unity and the ARKit Native functions/structures m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface(); // Create the configuration struct for this ARKit session ARKitFaceTrackingConfiguration config = new ARKitFaceTrackingConfiguration(); config.alignment = UnityARAlignment.UnityARAlignmentGravity; config.enableLightEstimation = true; // If the config file looks good, start the ARKIT session and add FaceAdded, FaceUpdated, and FaceRemoved as callback functions on ARKit events if (config.IsSupported) { m_session.RunWithConfig(config); UnityARSessionNativeInterface.ARFaceAnchorAddedEvent += FaceAdded; UnityARSessionNativeInterface.ARFaceAnchorUpdatedEvent += FaceUpdated; UnityARSessionNativeInterface.ARFaceAnchorRemovedEvent += FaceRemoved; } // Fire the init/start functions necessary for Peertalk PTCToCBridge.CallPTConnect(); // Instantiate the blendshape GUI style blendshapeGUIstyle = new GUIStyle(); blendshapeGUIstyle.font = yikes; blendshapeGUIstyle.fontSize = 30; }
public void SendVisageExpressions() { float noseWrinkler = actionUnitValues[0]; float jawOpen = actionUnitValues[3]; float eyebrowsUp = (actionUnitValues[9] + actionUnitValues[19]) / 2; PTCToCBridge.CallSendVisageExpressions(noseWrinkler, jawOpen, eyebrowsUp); }
public void SendARKitExpressions() { float mouthPucker = currentBlendShapes ["mouthPucker"]; float jawOpen = currentBlendShapes["jawOpen"]; float browInnerUp = currentBlendShapes ["browInnerUp"]; PTCToCBridge.CallSendARKitExpressions(mouthPucker, jawOpen, browInnerUp); }
//*********** APPLICATION STATE HANDLERS ***********// void OnApplicationPause(bool pauseStatus) { if (pauseStatus == true) { // we are paused } else if (pauseStatus == false) { //let's connect PTCToCBridge.CallPTConnect(); } }
//*********** INIT ***********// void Start() { PTCToCBridge.CallPTConnect(); faceTranslation = new Vector3(0, 0, 0); faceRotation = new Vector3(0, 0, 0); relativeRotation = new Vector3(0, 0, 0); lipVertexIndices = new int[] { 135, 23, 282, 139, 130, 0, 85, 87 }; lipVertices = new Vector3[lipVertexIndices.Length]; ARKitFaceNotDetectedTimer = 0.5f; faceDetected = false; unityMessageText.gameObject.SetActive(false); }
public void SendVisagePuckerValues() { PTCToCBridge.CallSendVisagePucker(lipVertices [0].x, lipVertices [0].y, lipVertices [0].z, lipVertices [1].x, lipVertices [1].y, lipVertices [1].z, lipVertices [2].x, lipVertices [2].y, lipVertices [2].z, lipVertices [3].x, lipVertices [3].y, lipVertices [3].z, lipVertices [4].x, lipVertices [4].y, lipVertices [4].z, lipVertices [5].x, lipVertices [5].y, lipVertices [5].z, lipVertices [6].x, lipVertices [6].y, lipVertices [6].z, lipVertices [7].x, lipVertices [7].y, lipVertices [7].z); }
public void SendVisageOrientation(float x, float y, float z) { PTCToCBridge.CallSendVisageOrientation(x, y, z); }
public void SendCalibrationErrorMessage() { PTCToCBridge.CallSendPTSimpleMessage("calibrationError"); }