KybernetikGames / animancer

Documentation for the Animancer Unity Plugin.
66 stars 8 forks source link

Layered animations with a crouch additive layer. #282

Closed JonathanSwallow closed 1 year ago

JonathanSwallow commented 1 year ago

Hi KybernetikGames

I hope you are well. I'm working with a 3D Character. And I'm wondering if you could spare some time to point me in the right direction regarding layers to make my character crouch.

My current setup is as follows; Layer 1 : baseLayer - contains only a LinearMixerTransition. It has 3 animations tied to it. Idle, walk and run. Layer 2 : crouchLayer - contains only a crouch pose which I was hoping could additively make the base layer look crouched. I’ve tried masks, following the docs ( https://kybernetik.com.au/animancer/docs/examples/layers/ ) and examples you’ve provided. Guessing I’ve missed something. I hate to do this but if it helps here is my primitive code for initialising the Animancer component.

_movementLayer = _animancer.Layers[0];
_movementState = (LinearMixerState)_movementLayer.Play(_movement);

_crouchLayer = _animancer.Layers[1];
_animancer.Layers[1].IsAdditive = true;
_animancer.Layers[1].SetMask(_crouchMask);
_crouchState = _crouchLayer.Play(_crouch);

If you need anything further to assist I’ll get it over asap. Thanks, Jon

KybernetikGames commented 1 year ago

What does it actually look like? I've never worked with additive animations and I'm not sure if it's possible for adding one pose to idle/walk/run to make them look reasonably crouched, but code-wise what you've got is fine.

JonathanSwallow commented 1 year ago

Thank you for getting back to me. I've linked a video from my channel. It shows what the current setup is producing. https://youtu.be/JCDkrJ-Z-LM

Honestly, the more I read your message the more I wonder if I'm trying to reinvent the wheel. I'll instead animate a crouched version of the movement animations.

Great product btw. I will be buying when my game sees a release!

Cheers Jon

KybernetikGames commented 1 year ago

Yeah, I think you will probably need to make proper crouched animations for each movement type.

Animancer Pro is currently 50% off in the Spring Sale if you plan on buying it any time soon.