- Home /
Mecanim BlendTree non-linear behaviour?
We have been using Mecanim and root motion animation to move a generic rig character in predetermined paths around a world. In order to do that and get him to actually stop on the end waypoint, we have had to calculate the stopping/braking distance, given a set linear deceleration and the transition to idle at the end. The problem is, it would seem that the root motion resulting from the blends is non-linear, regardless of the blend type, resulting in quite a large positional error at the end of the movement.
To verify, we have created an animation clip of a cube sliding by 1 unit and set up a blend of that clip, with control points at 1, 2, 5 and 10, running the clip at 1x, 2x, 5x and 10x speed respectively.
The actual resulting speed of the root motion, as found by integrating animator.deltaPosition or the actual position in space, is pretty much spot on on the control points and pretty far out half-way between. I have attached a couple of graphs that illustrate the problem.
The question is, are we using this the right way or have we conceptually misunderstood something? We could discretise and calibrate the errors away but would this be the right way to go on about this?
Edit: Does anybody have any information about what kind of interpolation is applied to the animation curves between points on the different blend trees? This whole problem would be much easier to solve if it was not such a black box we have to calibrate errors away from and we seriously can't help but think that we are missing something!
I'm running into the same problem, I'd be very interested if someone knows what's going on!
Trying to blend an 'idle' animation (speed 0) with a 'walk' animation (speed 1.6). At 0.8 input speed, the character is hardly moving at all. Only around 1.3 you get the impression that he is walking at half of his 'normal' speed of 1.6. Why isn't this blending linear?
$$anonymous$$artijn
At speed 0 the clip isn't playing. Hence you are blending 0 speed with your motion. This would also happen if the clip is playing, I assume, as your idle animation probably doesn't include any directional leg movement. You could place one of the animations on a higher level and use a Body$$anonymous$$ask to isolate the upper body for use with the idle, leaving the walk in control of the lower body.
Answer by AlkisFortuneFish · Sep 09, 2014 at 11:11 PM
The answer to this was given by Pierre-Paul Giroux, one of the Mecanim developers, on the "To Mecanim And Beyond" presentation at Unite 2014.
Apparently, the result of blending position-based root motion of two animations results in a non-linear blend and they are adding an option to make it linear in Unity 5.0... Some explanation of this somewhere in the documentation really would have been useful!