Hello! I've been having an issue with my main character's walk cycle that I've not been able to get rid of, no matter the amount of fiddling with destination accuracy and acceleration/deceleration, so I thought I should see if this is known, or I'm just doing something silly.
I'm using point and click control, and I start the character walking. After a moment, I click somewhere else which, nine times out of ten, causes him to turn around, and start walking to the new target. The remainder of the time, the character turns to face the new target, animates as though he's walking that way, but continues to move towards the first destination. Sometimes, he'll move to the new point, but very slowly, as though still being pulled. It is more likely to happen if the character is walking towards a hotspot target, and also if they are running.
The problem stops happening if I turn off root motion, but then a whole lot of animations that are dependent upon it (e.g. walking up stairs, climbing on top of things) no longer work. Before 1.50, this didn't seem to happen, though perhaps I'm just imagining that.
Additionally, it also happens when using direct control of a character (as shown in second part of the video). Changing to move in the opposite direction will cause the character to slide on the spot.
Comments
But! There are some things you can do to improve motion when root motion is involved, in order of complexity:
- Make sure your Root motion turning slider is zero if you are not using turn animations that specifically rely on root motion. When this value is non-zero, AC will assume the animation is handling the turning (just as it does with movement) and so won't do the turning itself.
- Enabling Turn before walking? gives better results as the character will stop and turn to move, reducing the likelihood of moving off the NavMesh or overshooting.
- Reducing the transition time between Idle/Walk and Walk/Run animations helps to keep the controller reactive to changing states. This reduces the chance of overshooting. Alternatively:
- Use Blend trees to control the Idle/Walk/Run transitions when using Root motion. Without Root motion, AC controls the movement speed and performs smoothing / acceleration / deceleration to keep characters on track. With Root motion, movement speed is controlled by the animation speed - so unless you use Blend trees, the movement speed can only ever be zero, or the fixed speeds determined by your walk/run animations. Blend trees allow you to scale the animation speed with the value of the "Movement speed" float parameter - allowing for scaled movement speeds in turn.
- If you have the budget, you can also look into relying on a dedidated third-party asset for movement. A tutorial for linking AC with the popular Motion Controller asset, for example, can be found here.
On a side note, I'm considering making an update to the 3D Demo to make use of the various features Unity has introduced since the first release. One of these would be an updated Brain character that relies on Root motion, which would demonstrate how the best results with AC alone can be achieved.