animancer icon indicating copy to clipboard operation
animancer copied to clipboard

Sample an animation clip and apply to an animancer layer?

Open kodra-dev opened this issue 9 months ago • 3 comments

I've run into this issue: https://forum.unity.com/threads/how-to-sample-pose-directly-from-an-animationclip.721160/

Basically what I need is Unity's AnimationClip.SampleAnimation, however applying the sampled data to a layer, not the whole gameObject, so that I can mix two samples.

The OP of that Unity forum thread said they eventually decided to use Animancer... which is great, but even with Animancer I still don't know how to do it.

kodra-dev avatar May 08 '24 13:05 kodra-dev

The Playing in Edit Mode page explains how you can use EditModeSampleAnimation for a single animation, so you'll need to make a method like that which takes multiple animations and sets them up in the layers you want.

KybernetikGames avatar May 09 '24 00:05 KybernetikGames

The only way I know to use layer is like this:

animancer.Layers[index].Play(clip);

I know animancer.Layers[1].Play(clip); actually work in edit mode, but it will cause the whole playable graph to be initialized and the that brings other issues... I'd just like to sample a frame, like EditModeSampleAnimation or Unity's AnimationClip.SampleAnimation, but mixed with layers (or at least with AvatarMask). I still can't figure out how to:

takes multiple animations and sets them up in the layers you want.

kodra-dev avatar May 09 '24 03:05 kodra-dev

The method I was thinking of is actually EditModePlay rather than EditModeSampleAnimation.

but it will cause the whole playable graph to be initialized

Yeah, then you can just pause or destroy the graph after you evaluate it.

KybernetikGames avatar May 09 '24 09:05 KybernetikGames