Now that you have imported your character into CRYENGINE, you may want to use it as the playable character. Follow the steps below to find out how to do this.
A character with a skeleton, mesh and animations imported into CRYENGINE (see previous tutorials)
Visual Studio (if you can't afford the full version, there is a free community version available here.)
Right-click on the Game.cryproject file and choose Generate Solution. A command prompt window will pop up that will perform several actions. This will take a while to complete.
It will be complete when the command prompt has closed.
When this is opened, in the Solution Explorer, navigate to Project → Game → Components and open Player.cpp;
You can also use the Search Solution Explorer bar at the top of the Solution Explorer to search for Player.cpp.
Importing your Animations
If you haven't already, import your animations into CRYENGINE. This is part of the Export & Import workflow explained in the previous tutorial.
To make sure the animations are working correctly, you can check them in the Character Tool:
In Player.cpp, look for the line that mentions SetCharacterFile and change the path to the path and file name of your character;
This should typically be around line 37-40, but this can change depending on any updates that may be made to this file.
It will, however, follow the comment // Set the player geometry, this also triggers physics proxy creation
.
In the main menu in Visual Studio, click Build → Build Solution or Build Game;
If other projects rely on the project you want to build, it is recommended to use Build Solution instead of Build Game.
Although your character will now be the playable character, its animations have not been assigned to it yet, so all you will see is your character in T-pose.
Repeat steps 3 and 4 for your Idle animation under Idle → <default> → Option 1;
For more variation in for example your Idle animations, you can set up multiple animation clips for the same situation.
1. In the Fragments panel, select the <default> folder for the Idle or Walk animations (depending on where you want to add an animation clip);
2. Click New at the bottom of the panel;
3. A new Option will appear under the <default> folder. Repeat steps 3 and 4 to add another animation clip. The Engine will automatically choose between the two animation clips when the character is Idle or Walking, depending on where you added the animation clip.
NOTE: You may have to add an Animation Layer in the bottom right. You do this by right-clicking on the ThirdPerson(ThirdPerson) text and choosing Add Layer → Animation Layer.
To have proper rotations set up, you'll have to set up blend spaces. Follow the next tutorial to find out how to do this.