Skip to content

Instantly share code, notes, and snippets.

@hyperlogic
Last active April 28, 2016 20:13
Show Gist options
  • Save hyperlogic/614b27bc12d89da03289b596b90387e8 to your computer and use it in GitHub Desktop.
Save hyperlogic/614b27bc12d89da03289b596b90387e8 to your computer and use it in GitHub Desktop.
High Fidelity script to replace all animations with a static pose
//
// disableAvatarAnimations.js
// examples
//
// Copyright 2016 High Fidelity, Inc.
//
// When launched, it will replace all of the avatars animations with a single frame idle pose.
// full body IK and hand grabbing animations will still continue to function, but all other
// animations will be replaced.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
var skeletonModelURL = "";
var jointCount = 0;
var excludedRoles = ["rightHandGraspOpen", "rightHandGraspClosed", "leftHandGraspOpen", "leftHandGraspClosed"];
var IDLE_URL = "http://hifi-content.s3.amazonaws.com/ozan/dev/anim/standard_anims_160127/idle.fbx";
function overrideAnims() {
var roles = MyAvatar.getAnimationRoles();
var i, l = roles.length;
for (i = 0; i < l; i++) {
if (excludedRoles.indexOf(roles[i]) == -1) {
MyAvatar.overrideRoleAnimation(roles[i], IDLE_URL, 30, false, 1, 1);
}
}
}
function restoreAnims() {
var roles = MyAvatar.getAnimationRoles();
var i, l = roles.length;
for (i = 0; i < l; i++) {
if (excludedRoles.indexOf(roles[i]) == -1) {
MyAvatar.restoreRoleAnimation(roles[i]);
}
}
}
overrideAnims();
MyAvatar.onLoadComplete.connect(function () {
overrideAnims();
});
Script.scriptEnding.connect(function () {
restoreAnims();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment