- Home /
Animators deltaPosition is (0,0,0) when using override layers above root motion animation
I have a complex animation system built for a 2d platformer. The Animator is divided in to 4 layers:
Base
Overlay
Attack
Effects
Base animations include sprite animations and position deltas.
The problem I'm having is when playing (for example) an Effect Animation (without root motion curves) it causes the Animator.deltaPosition to be Vector3.zero in the OnAnimatorMove() Call despite the animation in the base layer having motion.
Is there any documentation on how the deltaPosition is calculated with multiple layers or if this is a bug? It's definitely not how I expected it to work.
My guess is that it's seeing there are no curves for the override animation and just ignoring the layers below.
Is there a way to change this behavior?
Edit: I've updated from 5.0 to 5.2 and now the root motion doesn't get applied even if the above layers are not playing an animation. It got worse.
Answer by wightwhale · Jan 11, 2017 at 10:34 PM
@Alamaurie Any chance you figured this out? I'm running into a similar issue.
Answer by Alamaurie · Jan 12, 2017 at 04:55 AM
I wrote a script that sits on top of my animator to dynamically adjust the weighting of each layer based on what layer was playing. When I play an animation I call Play(name, layer, ...) on my script which evaluates the highest layer currently playing and sets its weight to 1, the rest to 0.