From 49fadc563459b588a82c044d70513467aae08e39 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sun, 19 Nov 2023 14:50:20 +0100 Subject: [PATCH] Disable procedural eye blinking when face tracking is running --- applications/emocam/emocam1.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/applications/emocam/emocam1.js b/applications/emocam/emocam1.js index 1aac0ea..c8f5627 100644 --- a/applications/emocam/emocam1.js +++ b/applications/emocam/emocam1.js @@ -33,7 +33,9 @@ var webWindow; var yaw = 0; var roll = 0; var headTransform = null; - var lastDataArrived = Date.now(); + var lastDataArrived = Date.now() - 3000; + // Caching this value is a good idea because API calls are expensive + var isProceduralblinkingEnabled = true; button = tablet.addButton({ icon: ROOT + "images/face.png", @@ -84,11 +86,19 @@ var webWindow; var propList = ["headRotation", "headType"]; handlerId = MyAvatar.addAnimationStateHandler(function (props) { if (Date.now() - lastDataArrived < 2000) { + if (isProceduralblinkingEnabled) { + MyAvatar.hasProceduralBlinkFaceMovement = false; + isProceduralblinkingEnabled = false; + } return { headRotation: headTransform, headType: 4 }; } else { + if (!isProceduralblinkingEnabled) { + MyAvatar.hasProceduralBlinkFaceMovement = true; + isProceduralblinkingEnabled = true; + } return props; } }, propList); @@ -222,18 +232,6 @@ var webWindow; } } - function setEmotion(currentEmotion) { - if (emotion !== lastEmotionUsed) { - lastEmotionUsed = emotion; - } - if (currentEmotion !== lastEmotionUsed) { - changingEmotionPercentage = 0.0; - emotion = currentEmotion; - isChangingEmotion = true; - MyAvatar.hasScriptedBlendshapes = true; - } - } - function onWindowClosed() { webWindow = null; button.editProperties({isActive: false});