I’m making a side-scrolling platform game, so my character only needs to move in the X and Y coordinates, not in the Z. The game is still in 3D though; the best known example would be Little-Big Planet.
I’m using mecanim to animate the character. The most simple example is that the character is stood idle facing right, and upon a positive horizontal input he walks right. I’ve got this working, it’s really nice.
My problem is that when the character is playing his idle animation the ‘forward’ vector of his root wangs around a bit, which means when the user moves ‘right’ the character walks forwards in that slightly off-direction right instead of at a perfect 90-degrees. Of course, this is due to ‘Apply Root Motion’ which seems it should really have more options as to what areas of root motion to apply.
My character never walks backwards. If you press the opposite direction he does a 180. The turning animation I’m doing appears to turn a few extra degrees; meaning that he slowly drifts off. I’ve mostly fixed this using MatchTarget, but sometimes the character ends up doing a full 360 - there’s a bug somewhere, but I’m wondering if MatchTarget is the right approach?
I’m a competent programmer, so feel free to just throw code at me; but I’d like to know if Unity has some options for this kind of setup or if I’m going to have to roll my own.
I guess my overall question is: Has someone got this working well? Using what approach?