New Animation System


#1

I try, to figure out, what the new animation system dos mean.

In the change log is written:

New Animation System

This adds support for MyAvatar to use the new animation system. This is disabled unless the user has “Avatar > Use Anim Graph” enabled at start up. The current graph is a simple state machine that switches between the standard idle and walk animations.

The animGraph is hosted as a Gist for testing purposes.

The new animation system drives the avatar’s joints, however it’s not fully functional especially w.r.t. to scripting. Here’s a list of the APIs/method calls that aren’t working and suggested approaches to fix or deprecate.

MyAvatar

  • startAnimation / stopAnimation - Will add support, by overlaying the user specified animation over the current state machine. Stop will resume / reveal the underlying state machine. We should depreciate the priority though.
  • startAnimationByRole / stopAnimationByRole - Will add support, by overlaying the user specified animation but ONLY for the specified sub-state. We’ll need to define a set of standard roles, for example “idle” “walk” “run” “fly” etc. We should deprecate priority though.
  • getAnimationDetails / getAnimationDetailsByRole - deprecate.
  • setJointRotations, setJointData - currently should still work, but we need to preserve this functionality as it is used by walk.js
  • clearJointData - depreciate.

Animation Dialog

I think is still useful, so I would like to preserve it, however in the short term we might what to hide this dialog until it is working again.

Procedural Animation / IK

Currently this works because the existing IK / spine controllers take affect after the new animation is run. However, we want to move these systems into the new animation system. This is something we will do piece by piece over the next week.

Future Plans

Eventually, all of the old animation system will be removed, here are the classes marked for deprecation.

  • JointState
  • AnimationHandle
  • AnimationLoop
  • Animation
  • AnimationCache
  • HeadModel

Also, full support for the new animation system should be exposed to our users.

  • An avatar’s animGraph should be an entry in the fst file.
  • Access to and freedom to manipulate the anim graph variables.
  • Access to and freedom to manipulate the anim graph itself, in JavaScript

Well I have used the old functions in my scripts and they have worked well for me. They are usefully for adjusting poses.

"setJointRotations, setJointData - currently should still work, but we need to preserve this functionality as it is used by walk.js "

Yes I can set the joint data until now, but getJointsRotations doesn’t work right in the moment.

So some more information, example and maybe also some discussion would be nice.


#2

Finally I have found a way, to set and change my poses also without MyAvatar.getJointRotation. Standing on the head sometime dos help, to get new ideas.

Here some examples of what I set (1. value) and what I get back with Quat.safeEulerAngles(MyAvatar.getJointRotation(posejoint)); (2. value).

{joint:joints.Spine1, rotation: {x:-4.17497290072788e-7, y:-1.677213701256619e-9, z:9.221501784395514e-9}},
{joint:joints.Spine1, rotation: {x:173.0262451171875, y:0, z:0}},

{joint:joints.Neck, rotation: {x:7.651110649108887, y:-0.016224443912506104, z:0.13151095807552338}},
{joint:joints.Neck, rotation: {x:-172.65280151367188, y:-0.2166527956724167, z:-1.7227323055267334}},

{joint:joints.Head, rotation: {x:-21, y:0, z:2}},
{joint:joints.Head, rotation: {x:166.22265625, y:0.03394769877195358, z:-3.7090351581573486}},

{joint:joints.LeftShoulder, rotation: {x:-60, y:0, z:0}},
{joint:joints.LeftShoulder, rotation: {x:-125.13062286376953, y:-106.03895568847656, z:-23.148836135864258}},

{joint:joints.RightShoulder, rotation: {x:-50, y:-30, z:0}},
{joint:joints.RightShoulder, rotation: {x:163.0431671142578, y:116.4120101928711, z:-66.7793960571289}},

{joint:joints.LeftArm, rotation: {x:50, y:16, z:9}},
{joint:joints.LeftArm, rotation: {x:-142.8502655029297, y:-115.6725082397461, z:41.6285285949707}},

{joint:joints.LeftForeArm, rotation: {x:-75, y:-14, z:-1}},
{joint:joints.LeftForeArm, rotation: {x:163.5516357421875, y:-101.2723159790039, z:22.951976776123047}},

{joint:joints.LeftHand, rotation: {x:-110, y:-80, z:20}},
{joint:joints.LeftHand, rotation: {x:88.0830078125, y:-16.40041732788086, z:12.694557189941406}},

{joint:joints.RightArm, rotation: {x:80, y:80, z:56}},
{joint:joints.RightArm, rotation: {x:-140.51979064941406, y:31.4014949798584, z:-52.00981140136719}},

{joint:joints.RightForeArm, rotation: {x:-69, y:-34, z:-29}},
{joint:joints.RightForeArm, rotation: {x:168.00270080566406, y:25.449533462524414, z:3.5767972469329834}},

{joint:joints.RightHand, rotation: {x:-100, y:30, z:-30}},
{joint:joints.RightHand, rotation: {x:87.14627838134766, y:-9.445550918579102, z:27.91935920715332}},

{joint:joints.LeftUpLeg, rotation: {x:20.88703155517578, y:-15.883438110351562, z:0.0010265837190672755}},
{joint:joints.LeftUpLeg, rotation: {x:18.991682052612305, y:164.1422119140625, z:-1.0648537874221802}},

It would be great, if this would be corrected.


#3

Very much just a guess, but looking at the returned values, perhaps they are global (world) frame values?


#4

What ever these values are, I think MyAvatar.getJointRotation and MyAvatar.setJointRotation should work with the same values.

A other thing, which doesn’t work right - if I use MyAvatar.goToLocation, the value MyAvatar.position isn’t updated with the new position.


#5

This new system is not enabled by default, is not yet documented properly or exposed in a user friendly way. But our plan is to move all avatar animations over to this system, once it is more robust. In a nutshell, this is a blend tree style animation system, which will give us much more flexibility when composing multiple animations with procedural controllers such as IK. Our plan is to open it up to users in a few ways.

  1. Using existing methods such as playAnimation and playAnimationByRole, and setJointRotation.
  2. Being able to override inputs to the system, this can give you control to, for example,
    take control over the IK end effectors (hands and feet).
  3. Having the ability to create your own blend trees composed of your own
    animations and transitions. As well as the ability to modify our existing standard blend trees.

To see what the data file for our system looks like, here is an example that is composed of a state machine with 7 states (idle, walk forward, walk backward, strafe left, strafe right, turn left and turn right)


#6

Thanks @hyperlogic for the information. Nice, that we get more possibilities.

But well, you work there with fbx animations. As long as Blender don’t work right, this dos mean, that many people can’t create own animations. So the onliest way would be - setJointRotation. To use this function also for procedural animations it would be helpfully also to have the function getJointRotation. Maybe this function also could be integrated in the new animation system.


#7

Oh, I wasn’t aware that blender did not support fbx animations, I thought it did. Also, yes, setJointRotation and getJointRotation should work, I will create a bug report for this, and follow up.


#8

Fbx animations do work, but there is an long standing issue with the rotations,

Please See
https://alphas.highfidelity.io/t/ultimate-blender-compendium-woes-of-the-blender-fbx-export-at-the-mountains-of-documentation-madness/4739/48 and my brute force thread

https://alphas.highfidelity.io/t/blender-the-madness-returns-community-help-needed/7130

Edit: fixed link


#9

For some reasons a figure placed in my domain with the Idle.fbx animation attached keeps getting turned off. I look and the tick box for animation running is off each time… yet I have not touched it and the domain doe snot allow anyone else to edit. Anyone else spotted that?

While here, does anyone have a simple free to use sitting FBX animation. The various furnishing son the asset marketplace are only models and not scripted to have the chairs work. It would be nice to have a simple example that allowed for a touch to sit/unsit or something like that. Avatars get tired feet too you know :slight_smile:


#10

in the little piece of code in the properties thing u need to turn it to true


#11

Yeah, right now I am playing with animations and maybe this has already been covered or non existent, but some FBX animations have a jump, which I believe is simply not there.