Additive Animation Layer support?

Is there any way currently to use Animation layers from Unity as Additive Animation layers? E.g. a product has an animation for opening a panel, and an additive animation layer on top of that manipulates a piece of that panel while it stays open?

Original Post on Discord

by user 103054507105067008

Not supported right now, recommend making a top-layer state machine for now

i just want to double check: you’re saying that you can only have 1 layer here inside an animatorController?

by user 352282921056468993

by user 352282921056468993

so in this example, only “Base Layer” would work - and not “Talking”

by user 352282921056468993

Just for context, this is avatar where different animations happen for the avatar’s body/gestures than what happens for the mouth/face

by user 352282921056468993

Hi, that’s correct - currently only the first layer is exported and used at runtime

is it possible to do layers or blending in your scripts (even tho i know it’s not possible in unity editor) - or it’s not available there either? Struggling to figure out how to only use one layer and still use AnimatorController with example i gave above

by user 352282921056468993

also just pointing to a solid example where there is a model with 1 rig that has 2 separate animations running at same time would be useful too

by user 352282921056468993

We’re using three’s animation system for Animation/Animator/Timeline support (with lots of code for state management on top), but nothing stops you from mixing your own things :slightly_smiling_face:
https://threejs.org/docs/#manual/en/introduction/Animation-system
https://threejs.org/docs/#api/en/animation/AnimationMixer

1 Like

that’s actually exactly what ive been trying to understand all day hahah - will keep at it thanks. Just as a note: found this great example in threejs that does what i want: three.js examples

however, the issues arise due to interactions with Unity editor. Trying to figure out how to do that same threejs functionality when several values are passed as public object through unity editor gets confusing

by user 352282921056468993

do you all have any idea how to get multiple animation clips from unity editor to ts file? whenever i try this, it only gets the main animation clip - it doesnt see any of the animation clips in the array of them


Screenshot_2024-02-08_171513.png

by user 352282921056468993

You can make your own “MyAnimation” component that has e.g.

@serializable(AnimationClip)
listOfAnimations: Array<AnimationClip>

and do whatever you want with the clips then in the three.js side (e.g. our Animation and Animator component spin up three’s AnimationMixer to play and blend clips etc.)

But accessing the array from animations above should work too, I can’t see that part of your code in your screenshot though

will try that

by user 352282921056468993

well the code just uses the .animations - but when logging it, there is only ever one clip

by user 352282921056468993

I’ll have to look at that here
Please let me know how the other test goes!

The example here is not an array. See felix comment below

If you want to handle animation blending yourself and creating a mixer you can just export your animations like this:

export class MyAnimations extends Behaviour {

    @serializable(AnimationClip)
    animations?: Array<AnimationClip>;

    start(): void {
        console.log("My animations", this.animations);
    }
}

Capto_Capture_2024-02-09_05-24-07_PM.png
Capto_Capture_2024-02-09_05-24-28_PM.png

I think what was suggested is that the „animations“ array of our Animation component does always only contain one element and not the array set in Unity, but I haven’t looked at it yet