Import Blender fbx to Unity Mecanim
In the previous tutorial I rigged the cartoon dog character for use it in Unity-3D Mecanim animation system and in this tutorial we will do this. I exported the model as fbx-file directly to a folder used in a Unity-project. The project is the default Unity-Mecanim demo in which a robot-character is running and jumping in a small arena.
Again I created a youtube video in which you can see all steps I made from exporting the model to animating it in the Unity-environment.
Here I described the steps that you have to do to import a model to Unity as a controllable character with animations for the mecanim system:
Import the fbx to Unity-3D
For our tutorial we loaded the Unity mecanim examples to Unity-3D. After that we created a folder to which the model (fbx) will be exported. When doing this, the Unity fbx-importer automatically does his job to import the dog-model for us:
You can see here that the model and the rig (metarig) are imported.
Tip: You have to set the size of the Fbx-model to 1 in the importer’s panel:
Humanoid rig in Unity-3D
After that we change the Rig to Humanoid and check if all bones are imported correctly:
If the bones and joints of the imported model are green then everything is fine. If not, try to enforce the T-Pose for the model:
Applying animations in mecanim
The cool thing is that you can use existing mecanim-animations and animation controllers (I will demonstrate this in an next tutorial) for any other humanoid rig. This is the next step: Drag ‘n drop the dog model to the scene and add an existing animation controller to it.
In the mecanim demo in the folder Controllers there is a controller called Layer. Drag this controller to the Animator controller of the dog:
Control the character
We also need other components for the character to control it with the keyboard and the mouse. We add a Rigidbody component to it so that the character has gravity:
and then we add a character controller component:
To be able to let the dog jump on mouse-click we add the script IdleJumpRun from the Scripts-folder to the dog.
The Wow-Camera
I wanted to use a camera like in the game World of Warcraft. Therefore I applied the Script you can get on this page to the main camera. The camera is following the character when you move it and when you press a mouse button you can rotate the camera. You can also zoom the camera with the mouse-wheel.
Now you can start the project and you will be able to control the animated dog through the environment of the mecanim demo.
If you have any questions please let me know. Subscribe to our youtube channel and ask questions there, I will answer these as soon as possible.