As with any project, we will run into unexpected issues.
In our project, we have an issue with the Robot AI running animation.
Above we can clearly see there are issues with our movement animations.
It looks like he has completely broken his ankle (but doesn’t care)!
There are 2 approaches to solve this.
We can either replace the broken animations or fix the existing animations.
As the existing animations are basically from mixamo.com, we’ll just replace them with the current mixamo.com equivelant animations.
If I pause, I can see the foot is clearly below the floor and twisted.
It also looks like the red spheres representing joints are broken.
If I look at the original FBX prefab for the Robot model, I don’t see anything obviously wrong.
You can get to this screen by selecting the FBX prefab of your game object in the Project window, then clicking the “Rig” tab in the Inspector window and clicking the “Configure” button.
You could also click the “[Game Object Name] Avatar” in the Project window and then the “Configure Avatar” button in the Inspector window.
Only after rotating around the animation, I was able to discern the running animation itself was broken.
Mixamo to the Rescue
We can make use of the free animation assets on Adobe’s mixamo website to replace our broken animation.
After selecting the animation I wish to use, I need to select the “In Place” setting before downloading.
After clicking the first Download button, I want to set the FBX format as for Unity and up the Frames per Second to 60.
30 FPS is more for tv/movies and that sort of media.
Then I cut or copy over the downloaded file(s) to my Asset folder for my project.
We always need to remember to set the newly import FBX as a “Humanoid” Rig.
Also, make sure to hit the “Apply” button.
If we forget this step, the next steps won’t work correctly and will have to be redone!
Now, I’ve used CNTRL + D to duplicate the running animation from the downloaded “xbot@Running” file in Unity.
I’ve renamed it so that its different from my current running animation.
I then need to enable “Loop Time” and “Bake Into Pose” for all Root Transform Rotation sections.
Lastly, in the Animator window I select my Running State, and assign this new “Running2” animation to the “Motion” field.
I’ve also enabled the “Foot IK” for both the Walk and Run States.
Unfortunately the gif I had of the current results was too big for Medium.
However, suffice it to say, the run animation now works as expected but I’ve noticed an issue with the walk animation.
I downloaded another animation from Mixamo.com, “Standard Walk” using the same settings as for the earlier animation.
I’ll show the process again with the walk animation since this is a common issue.
After setting the rig for “xbot@StadardWalk” to Humanoid, we duplicate the animation and enable the fields shown above.
Now we can open the Animator window that shows our Animator Controller settings.
Select the Walking State and assign the new walking animation to the “Motion” field.
We can see the walking animation is now working as desired, but now I notice the idle animation has the feet below the floor level.
This project is based on the premise that we are working with others who have provided these assets, so normally we’d ask them to fix the issues.
But I do want to highlight that even without the original creators, we can fix these ourself and so we shall!
As I’ve already shown this process twice, I won’t show the steps taken to import my new cover idle animation downloaded from mixamo.com.
The new animation is working much better.
With the new idle animation in place, everything is working as expected.
We could easily spend days fine-tuning this to look much better and create a more complex Animator Controller for changing of states to accommodate that.
But we’re focused more on the AI aspect of this prototype.
So just now we could clean this up even more, but we won’t at this time.