repo: janusweb action: commit revision: path_from: revision_from: 96a5ab86137c5e122aaa685724406c3b1d5d6907: path_to: revision_to:
commit 96a5ab86137c5e122aaa685724406c3b1d5d6907 Author: James BaicoianuDate: Mon Oct 4 00:21:59 2021 -0700 Use morph targets to blink and flap mouth diff --git a/scripts/remoteplayer.js b/scripts/remoteplayer.js
--- a/scripts/remoteplayer.js
+++ b/scripts/remoteplayer.js
@@ -169,6 +169,25 @@ elation.component.add('engine.things.remoteplayer', function() {
this.mouth.audio.gain.gain.value = volume;
}
}
+ this.setSpeakingVolume = function(volume) {
+ // FIXME - Quick hack to flap our mouth based on our speaking volume if we have blendshapes
+ // Probably only works with Ready Player Me avatars
+
+ if (this.body) {
+ this.body.setMorphTargetInfluence('mouthOpen', volume);
+ }
+ }
+ this.blink = function() {
+ if (this.body) {
+ this.body.setMorphTargetInfluence('eyesClosed', 1);
+ setTimeout(() => {
+ this.body.setMorphTargetInfluence('eyesClosed', 0);
+ }, 100);
+ }
+ setTimeout(() => {
+ this.blink();
+ }, 2500 + Math.random() * 8500);
+ }
}, elation.engine.things.janusghost);
});
-----END OF PAGE-----