Last active
April 28, 2016 20:13
-
-
Save hyperlogic/614b27bc12d89da03289b596b90387e8 to your computer and use it in GitHub Desktop.
High Fidelity script to replace all animations with a static pose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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