By default, avatars in High Fidelity will use the built in standard set of animations. However, these animations are generic and masculine, which do not always fit the character of some avatars, such as dainty ballerinas or cartoon foxes. It is possible to modify the avatar animations by inserting new animations to replace existing ones. Additionally, advanced technical animators can adjust the animation state machine and the interpolation and blend parameters for truly unique avatars. Here are some guidelines for creating animations in the proper format:
See this document for more information about our avatar standards.
This document lists several ways to modify the avatar animations, from the easiest but least flexible, to the hardest but most flexible approach.
The script call MyAvatar.overrideAnimation can be used to play any animation on the current avatar. It will smoothly interpolate from the avatar's current pose into the start frame of the provided animation. If the animation is hosted remotely, you can use AnimationCache.prefetch to ensure that the animation is in-memory before playback. Otherwise you might see a few frames of t-pose as the animation is downloaded from the remote source. This animation will take complete control over all the avatars joints. Inverse Kinematics of the hands and head for HMD users will be disabled. MyAvatar.restoreAnimation can be used to stop the override animation and restore the avatar to its normal set of animations.
The default animation state machine has a list of specific animations or 'Roles' that can be overridden. The MyAvatar.getAnimationRoles() script call can be used to get the list of roles for the current avatar. Each one of these roles can be replaced by a custom animation via the MyAvatar.overrideRoleAnimation call. Here is the current list of roles followed by a brief description.
The standard animation FBX files for these roles can be found in the High Fidelity source code repository on github.
When wearing an avatar in High Fidelity, the animation system must blend and layer a series of animations from FBX files as well as perform Inverse Kinematics on the joints to best match the head and hand sensors. The way these animations are blended is not hard coded, but rather a data file specifies exactly which animations to play and how they are blended. It also determines the order of operations, such that operations like Inverse Kinematics occur after the rest of the body has been animated by traditional means. By default, every avatar uses the same Animation Graph file. However, advanced users and content creators can specify their own Anim Graph definition file. This file is in the JSON file and it contains a hierarchical tree of nodes similar to Natural Motion's Morpheme or Unity's Mecanim. The specific contents of this file are not yet documented, but will be soon. However, a content creator can perform a simple change by substituting the FBX urls with their own custom animations. For reference here is the current default avatar-animation.json file. In the Settings > Avatar dialog the Avatar animation JSON field can be used to change the animation graph of the current avatar. Secondly, a animGraphUrl entry can be added to a specific avatar's FST file. For example: animGraphUrl = https://s3.amazonaws.com/hifi-public/tony/scoot-animation.json The above scoot-animtion.json file replaces the idle and walk animations with a sitting pose. It is intended to show an example of replacing some but not all of an avatar's default animations.