diff --git a/scripts/system/assets/animations/Cheering.fbx b/scripts/system/assets/animations/Cheering.fbx index 7439c5f409..8787bf4bd8 100644 Binary files a/scripts/system/assets/animations/Cheering.fbx and b/scripts/system/assets/animations/Cheering.fbx differ diff --git a/scripts/system/assets/animations/Clapping.fbx b/scripts/system/assets/animations/Clapping.fbx index 10f3f5036d..d05b41866d 100644 Binary files a/scripts/system/assets/animations/Clapping.fbx and b/scripts/system/assets/animations/Clapping.fbx differ diff --git a/scripts/system/assets/animations/Crying.fbx b/scripts/system/assets/animations/Crying.fbx index 5117a4156c..2e60ba2450 100644 Binary files a/scripts/system/assets/animations/Crying.fbx and b/scripts/system/assets/animations/Crying.fbx differ diff --git a/scripts/system/assets/animations/Dancing.fbx b/scripts/system/assets/animations/Dancing.fbx index 405684f1d9..7759d273b7 100644 Binary files a/scripts/system/assets/animations/Dancing.fbx and b/scripts/system/assets/animations/Dancing.fbx differ diff --git a/scripts/system/assets/animations/Fall.fbx b/scripts/system/assets/animations/Fall.fbx index b189cf40a2..627e909bb4 100644 Binary files a/scripts/system/assets/animations/Fall.fbx and b/scripts/system/assets/animations/Fall.fbx differ diff --git a/scripts/system/assets/animations/Pointing.fbx b/scripts/system/assets/animations/Pointing.fbx index b493d2e539..da3c9bbeca 100644 Binary files a/scripts/system/assets/animations/Pointing.fbx and b/scripts/system/assets/animations/Pointing.fbx differ diff --git a/scripts/system/assets/animations/Surprised.fbx b/scripts/system/assets/animations/Surprised.fbx index 9422e7730e..49362605b3 100644 Binary files a/scripts/system/assets/animations/Surprised.fbx and b/scripts/system/assets/animations/Surprised.fbx differ diff --git a/scripts/system/assets/animations/Waving.fbx b/scripts/system/assets/animations/Waving.fbx index 7a52a0f6ed..e2442f64f4 100644 Binary files a/scripts/system/assets/animations/Waving.fbx and b/scripts/system/assets/animations/Waving.fbx differ diff --git a/scripts/system/emote.js b/scripts/system/emote.js index 434479392e..fc02c738c3 100644 --- a/scripts/system/emote.js +++ b/scripts/system/emote.js @@ -40,6 +40,7 @@ var onEmoteScreen = false; var button; var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var activeTimer = false; // used to cancel active timer if a user plays an amimation while another animation is playing +var activeEmote = false; // to keep track of the currently playing emote button = tablet.addButton({ //icon: "icons/tablet-icons/emote.svg", // TODO - we need graphics for this @@ -77,14 +78,23 @@ function onWebEventReceived(event) { Script.clearTimeout(activeTimer); } - var frameCount = ANIMATIONS[emoteName].animation.frames.length; - MyAvatar.overrideAnimation(ANIMATIONS[emoteName].url, FPS, false, 0, frameCount); + // if the activeEmote is different from the chosen emote, then play the new emote. Other wise, + // this is a second click on the same emote as the activeEmote, and we will just stop it. + if (activeEmote !== emoteName) { + activeEmote = emoteName; + var frameCount = ANIMATIONS[emoteName].animation.frames.length; + MyAvatar.overrideAnimation(ANIMATIONS[emoteName].url, FPS, false, 0, frameCount); - var timeOut = MSEC_PER_SEC * frameCount / FPS; - activeTimer = Script.setTimeout(function () { + var timeOut = MSEC_PER_SEC * frameCount / FPS; + activeTimer = Script.setTimeout(function () { + MyAvatar.restoreAnimation(); + activeTimer = false; + activeEmote = false; + }, timeOut); + } else { + activeEmote = false; MyAvatar.restoreAnimation(); - activeTimer = false; - }, timeOut); + } } } }