Hey everyone, I’m running into a rather annoying animation issue, and I don’t know where to go from here.
In our game, we have stationary attacks that should not include any player movement (similar to minions attacking each other in Starcraft). The attacks always transition back to idle.
I have root transform position baked into pose to prevent any root motion from occurring, and the animation preview itself shows no movement, but the character moves a little bit every time he transitions back to idle and his feet slide. So, if he continues to attack, he slowly moves across the screen - obviously not a desired outcome.
I’ve been searching these forums over the past week with no luck, but if anyone has a suggestion or could point me toward a solution, it would be greatly appreciated.
Have you similarly removed root motion from your idle? If not, as the root motion transitions back in you’ll get some “leak” between the states. Even if your idle root motion averages to zero, because you’ll be transitioning back to it from the same part of the attack animation every time the average of the leaked portion could be different, and that would cause your drift.
Also, for my character controller I’ve had a lot of success in turning “apply root motion” on and off depending on my character’s state. In some states I want to drive animation from motion, on other states I want to drive motion from animation, and I’ve so far had no issues switching between the two.
I’m a big fan of controlling things explicitly, so to me it makes a lot of sense to tell my controller not to apply root motion when I don’t want it, rather than tweaking the animations so that there’s nothing to apply.
Thanks for the response. Yes, root motion has been removed from idle as well. However, when looking at the transitions between the two animations, the red dot moves slightly as the animations transition. This is giving me a sinking feeling that the issue may lie somewhere in the art pipeline and isn’t anything I can adjust myself.
I’m going to try switching apply root motion based on state as you suggested, though I don’t believe that’s going to fix the issue. I tried locking the player’s position via the Rigidbody, and that prevents the movement. However, if I unlock the movement when he goes back to idle, the transition translation once again occurs. =/
Are you sure you’ve got the animations set up correctly? My experience in the area is fairly low, but I’m certain that removing this kind of motion is well within Mecanim’s capacity.
As far as I can tell. I’ve attached a picture of the animation settings, but pretty much all root motion should be eliminated. These settings are consistent with all animations in the project, except that running always for xz movement.
This is a little out of my league, and I can barely even understand the question, but I know when your having trouble and seem to try everything it can be frustrating and any idea can help, so I’ll take a shot in the dark. I would write down the X and Z position of my character, then would Zero the X and Z Position for my Character and make it a child of an Empty, and then move the Parent Empty to where I had first placed my character. Worth a try I guess?