Hi all,
I’m completely new to animating models, in Unity and programming full stop. I’m trying to combine an animation of a guy running forward, with him raising his weapon.
I’m using the model from the locomotion system extension. And trying to combine the “RunForward” and “AimStraight” animations. As far as I understand it, I need to put the “AimStraight” animation in a higher layer and use additive blending.
Here’s my script…
public void Start () {
animation.wrapMode = WrapMode.Loop;
animation["AimStraight"].layer = 1;
animation["AimStraight"].blendMode = AnimationBlendMode.Additive;
animation.Play( "RunForward" );
animation.Play( "AimStraight" );
}
But the model just shows the normal running animation, so I’m not sure quite what’s going on…
Check out this example in the docs. You haven’t posted the contents of the Update function, but you should be calling Animation.CrossFade in the Update if you aren’t doing so.
Hmm, I’m confused… So I need to continually call CrossFade? I thought you just call it once and it crossfades from one animation to another?
All I’m trying to do is set up the running and gun aiming animations both at the same time. Obviously I’ll be doing more than that in time, but I’m just trying to get started, and grasp the animation system.
I’m still fighting with this… Any chance the model and it’s animations could be the problem? Anyone have any animated models that they know works with additive blending?
Hey Spectre1989
Have you solved this problem yet? I am actually experiencing the same thing, so would kill for a solution right now.
I’m working on something very similar right now. My character has an idle, run, and punch animation.
I don’t have the code with me, but i start with the idle animation playing, on moving i continuously call the run animation through a crossfade, then use .Blend(“runAnimation”, 0), to stop the run animation when i’m not moving.
Given an input to activate the punch, it the calls a crossfade to the punch animation. Run and Idle are in the same layer, punch is in a higher animation.
My punch animation is also using a mix transform so it only effects the top half of the body, allowing a smooth run and punch. These are all using the blend BlendMode. I’ve had some very strange distortions when using the additive mix so i’m trying to avoid it.
Hope this helps 