🏃♂️Character setup
In this section we will learn how to import and set up a custom character.
Last updated
In this section we will learn how to import and set up a custom character.
Last updated
We are going to use a Swat character from the Mixamo website:
Import the character to your project and click on the FBX file. Set the Animation Type to Humanoid, and Avatar Definition to Create From This Model:
Tip: You can also use the Generic animation type, for the system it doesn't matter whether the model is Generic or Humanoid. But keep in mind: Generics can not be retargeted! This means you can't share animations, unlike with Humanoids.
Drag your character to the scene and add the Animator component:
Choose the IKRigAnimator_Humanod as a Controller. This is a demo animator controller, which already includes all the character animations.
Now, let's add a Bone Container component to the Hip/Pelvis bone:
Bone Container will find all the character bones when added. It's required, if you character is modular, just like our Swat model:
Now we need to add RecoilAnimation and AnimEventReceiver components directly to the character:
RecoilAnimation will generate smooth weapon recoil, while AnimEventReceiver will process animation events.
Finally, we have to add the FPS Animator component - it's responsible for all animation logic in the system. Think of it as a central hub, that contains all the animation layers and applies them in realtime.
You will see a lot of warnings under the Setup IK Rig button:
To fix this, simply press the Setup IK Rig button. The system will automatically find all the bones and create IK objects.
Tip: sometimes this might fail, if the names are unusual or there's a problem with the avatar. If that's the case, you will need to manually assign and create bones mentioned in the warning log.
Now we need to create a new Avatar Mask, which will only include the upper body part of the character.
Create a new Avatar Mask by Right Click -> Create -> Avatar Mask and name it UpperBody:
If you have a generic character, you will need to manually specfiy the bones in the Transform category:
Create a new Animator Controller (Right Click -> Create -> Animator Controller) and name it FirstPersonAnimator_Tutorial. We will use this controller to play procedural walking and idle animations.
To do so, we need to create another Avatar Mask, which will animate the WeaponBoneAdditive only.
Create an empty Avatar Mask first, then add an empty GameObject to the rootBone and name it WeaponBoneAdditive:
Then, open up your Avatar Mask and go to the Transform category. Then import your character avatar and toggle all bones off:
Finally, we need to use a framework tool to add a custom bone. Go to the Window/FPS Animation Framework/FPS Animator Utility/Avatar Mask Modifier:
And that's how your Avatar Mask will look like:
Open your FPSAnimator, Anim Graph tab and assign the Upper Body mask and the First Person Animator we created earlier:
Now you can go to the Layers tab and hit the Play button. It will preview the currently selected animator. If you want to preview a specific animation, make sure to specify the clip:
The next step is camera setup.