Skip to end of metadata
Go to start of metadata

Overview

To turn the character you imported in the previous tutorial into your playable character, you will need to do make some small adjustments in the code.

Requirements

  • Visual Studio (or the Visual Studio Community version)

Generating a Solution

To get access to the code, do the following:

  1. Go to your project folder.
  2. Right click on the .cryproject file.
  3. Choose Generate Solution (this may take a while).

Defining the Playable Character

  1. When you have generated a solution, open the solutions/win64 folder and double click the Game.sln file.
  2. In this file, go to Components/Player.cpp:

    Player.cpp location

  3. Look for m_pAnimationComponent → SetCharacterFile (you can use CTRL + F for this) and change the path and file name to that of the imported character file.
  4. Build your project again by going to Build → Build Solution (or Build Game) in the main menu.

    It is recommended to close CRYENGINE while building a solution.

  5. Save and close Visual Studio.

Changing the Preview File

  1. In your project folder, navigate to the Assets/Animations/Mannequin/Preview folder.
  2. Open the Player.xml file with an XML editor, like Notepad or Notepad++.
  3. In the line that starts with <contextData name="ThirdPerson", change path and file name you used above, in step 3 of Defining the Player Character.
  4. Save and close the file.

Viewing Your Character in a Level

  1. Create a level or open an existing one.
  2. Drag and drop your character file from the Asset Browser into the level. It should appear in T-pose.

Mannequin Setup

Now that you have successfully changed the player character, all you need to do is assign the right animations to it.

  1. Open the Mannequin Editor and go to File → Load Preview Setup...
  2. Open the Player.xml file.
  3. In the Fragments panel, expand the Walk animation and double click on <default>/Option 1:

    Walk animation in Fragments panel

  4. In the Fragment Editor, select the ThirdPerson(ThirdPerson) timeline:

    Thirdperson timeline
  5. Now click the name of the Animation in the Anim Clip Properties to the right, click the browse button ()and choose your walk animation:

    Changing the animation

  6. Repeat steps 3-5 for the <default>/Idle animation.

    If you have more than one Idle animation, and you want the engine to choose between those randomly for some variation, you can add these by selecting Idle/<default> and clicking the New button:


    Adding more Idle animations

    This will add another "Option n" fragment, to which you can assign another animation.

    Keep in mind though that you may have to add a Layer on the timeline first by right clicking on the ThirdPerson(ThirdPerson) fragment in the Fragment Editor and choosing Add Layer → AnimLayer.

  7. Save your changes by going to File → Save Changes...

Rotate Animation

You may have noticed that when your character stands still and you move the mouse, it jumps back to its T-pose. This is because you have not assigned a Rotate animation yet.

However, to make Rotate animations work, we need to get into Blend Spaces, and that will be explained in another tutorial.

For now, simply assign the same animation to the Rotate fragment as you did for the Idle fragment earlier.


  • No labels