I am currently still using the player model from the tutorial package I downloaded and now that I have movement and some basic combat implemented, I wanted to import the main character model.
As the animations are saved in seperate Maya files, they needed to exported with a specific naming convention (as described by this article:
Above is an image of the project window and how the animations have been named. The main model file is called “dorje” and each animation is called “dorje@animname”. This is how unity works out that each animation is for the same model.
I faced some issues when importing the models. Mainly due to the pose of the rig. To fix this, I needed to enforce a T-Pose so that the skeleton is rotated correctly.
The default pose didn’t have many issues
However, the animation poses did have issues, as seen below:
By pressing the Enforce T-Pose button, Unity is able to rotate the skeleton so that it is in the correct pose.
Another issue faced was due to scaling. To fix this, I scaled Dorje until he reached the size I wanted and then made a note of how big he now was. I went back to the import settings and changed the scale factor setting to 18, which means scaling by 18x.
A new animator controller was needed to be added to handle the new animations. I used the same method as before, using a blend tree to smoothly transition between idle, walking and running. I made sure to keep the parameter name the same so the scripts should work
The last step was to make sure that Dorje has all the components needed in order to function correctly. I added the PlayerController, PlayerAttack, and PlayerLockOn scripts. I also added a NavMesh Agent, and RigidBody components. I added a new emtpy game Object and positioned it around Dorje’s shoulder height and set this to be the target in the Camera script. Finally, I updated the Player Manager object so that it referenced Dorje instead of the temporary player.
Leave a Reply