Skip to content

Instantly share code, notes, and snippets.

@hyperlogic
Last active October 28, 2019 15:58
Show Gist options
  • Save hyperlogic/95828fd3a6032f6967256596754050e0 to your computer and use it in GitHub Desktop.
Save hyperlogic/95828fd3a6032f6967256596754050e0 to your computer and use it in GitHub Desktop.
//
// blendshapetest-agent-server.js
//
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
(function() { // BEGIN LOCAL_SCOPE
var BLENDSHAPETEST_CHANNEL = "com.highfidelity.blendshapetest";
Agent.isAvatar = true;
Avatar.skeletonModelURL = "https://hifi-public.s3.amazonaws.com/tony/avatars/arkit/arkit_facecap_avatar.fst";
function onMessageReceived(channel, message, sender) {
if (channel !== BLENDSHAPETEST_CHANNEL) {
return;
}
print("AJT: msg =" + message);
var msg = JSON.parse(message);
if (msg.name === "hasScriptedBlendshapes") {
Avatar.hasScriptedBlendshapes = (msg.value === "on");
} else if (msg.name === "hasProceduralBlinkFaceMovement") {
Avatar.hasProceduralBlinkFaceMovement = (msg.value === "on");
} else if (msg.name === "hasProceduralEyeFaceMovement") {
Avatar.hasProceduralEyeFaceMovement = (msg.value === "on");
} else if (msg.name === "hasAudioEnabledFaceMovement") {
Avatar.hasAudioEnabledFaceMovement = (msg.value === "on");
} else {
Avatar.setBlendshape(msg.name, parseInt(msg.value, 10) / 100);
}
}
Messages.messageReceived.connect(onMessageReceived);
Messages.subscribe(BLENDSHAPETEST_CHANNEL);
}()); // END LOCAL_SCOPE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment