This page aims to explain the process of replacing a player character from the Isometric Pathfinding Template C++ template project with another animated model.
Please be advised that GameSDK is NOT used for this tutorial. It is based on the templates that are provided with the Engine, so create a new project using the Isometric Pathfinding template.
This tutorial can be used as a base for other templates, but these don't work exactly the same as the Isometric Pathfinding template. Please be careful when attempting this.
Tools used in this tutorial:
Download the following file and extract anywhere:
This is just an example asset. It is of course possible to use other .fbx characters.
Save it under objects/characters/
Importing will create several different assets related to this character model, so it is recommended to create a new folder inside objects/characters, e.g. objects/characters/deer.
The .zip file also contains a texture file, deer_texture.tif. To assign this to the deer model:
Drag the deer_texture.tif into the same folder in the Asset Browser.
When looking under Animations, it will become clear that the one animation that came with this model (i.e. Take 001) is actually made up of three different animations: an idle animation, a walking animation and a running animation.
First, it is important to know which frames represent which animation. To find this out, go to Character Tool -> Playback panel and change Seconds to Frames:
Changing seconds to frames
Check when the animations start and which frame is the last of each animation. Write these frames down for later use.
The first frame is the default pose and therefore not part of an animation. Make sure to skip this frame and start the first animation on frame 1.
To separate the animations:
Rename the animation clip from Take 001 to something relevant, like deer_idle.
Click Preview this to test the animation.
To add the skeleton of the deer, either the Character Tool can be used, or the skeletonlist.xml file can be edited.
Copy and paste the line for the existing skeleton onto the following line and replace the name and path to match your deer skeleton, e.g.
<Skeleton name="deer" file="Objects/Characters/deer/deer.chr"/>.
It is advised to name the skeleton the same as the name of the file that was imported earlier, in this case deer.
Now that the model and all its associated parts (skeleton, texture etc.) have been imported into the Sandbox, the template source code needs to be modified to load the new deer model instead.
Look for line 25, which contains m_pAnimationComponent->SetCharacterFile and replace the thirdperson.cdf with the deer.cdf, including its path. The line would then read something similar to:
The line number mentioned here may vary between Engine versions.
Change the model at the end of line 4 and 5 to your deer.cdf, including its path (like in step 5).
The character still needs to be set up to use the new animations that were imported earlier, because the animations from the third-person template (Motus character) are incompatible with the new deer skeleton.
In the Fragments tree in the top left, expand the Idle -> Walk animation and double-click Option 1:
Finding the Walk animation
To the right in the Anim Clip Properties, click the field next to Animation and change this to the deer_walk animation:
Changing animation clip
|The FirstPerson animation is not necessary, because this is an isometric game example, so if desired, the FirstPerson(FirstPerson): Walk animation that was not changed, can be deleted. It will not impact the game if this is not deleted.|
Now press Ctrl + G to test the deer in the template level. Clicking anywhere in the level or on the ramp should make the deer walk there.It is advised to name the skeleton the same as the name of the file we imported, in this case 'deer'