🔌Components

In this section we will quickly discuss the core components.

Add Components

FPS Animator will automatically add the FPS Bone Controller and User Input Controller. Now you need to add the FPS Playables Controller and the Recoil Animation components.

Your character inspector should look something like this:

Now let's see roles of each component we have just added.

FPS Animator

FPS Animator is a central hub component, which controls the flow of other entities in the framework. This component initiailizes, updates and disposes Bone Controller, User Input Controller and Playables Controller.

Later in this document we will cover the Linking, which is an extremely important part of this system.

You can specify the default Animator Profile, but this is optional. It is only useful for debugging purposes, in any other case it is recommended to dynamically link layers:

FPS Bone Controller

This component manages the procedural animation features. It is responsible for initialization, update, disposal and pose caching of procedural animations in realtime.

You do not have to directly reference this component in your code, as its flow is fully controlled by the FPS Animator.

User Input Controller

The FPS Animation Framework introduces a standalone input property system. The idea is that you can define custom properties in the Input Config asset and then use them in runtime:

This system is used to establish communication between the framework entities and your project code-base.

Example: let's say you want to disable aiming when jumping. You can create a new float parameter, set it to 1 or 0 in code based on the jumping condition, and then specify that parameter as a control value in the Ads Layer.

User Input Controller allows you to work with the property system, by getting or setting the values. This component only has a reference to the Input Config - make sure to assign the Input Config we created in the previous section:

Tip: the User Input Component inspector has a reall neat feature - it displays all the active properties and their values in the playmode.

Playables Controller

This component is responsible for playing custom animations in realtime. As the name suggests, it utilizes Unity Playables API to override standard Animator Controller behaviour, by adding custom animation layers. These layers override the character upper body to play your reloading, grenade throwing and other types of motions.

You must specify the upper body Avatar Mask in the component inspector - this will tell the system what bones will be affected by custom animations:

Your upper body mask needs to be adjusted in order to play custom animations. To do this, go to Window/FPS ANIMATOR/Tools/Avatar Mask Modifier. Now we need to add the WeaponBone object to the avatar mask. Specify the Root and the Upper Body Mask:

Tip: the WeaponBone will be used later in the animation workflow, essentially it contains the weapon movement.

The Playables Weight Property is used to control the influence of the Playbles Controller. You can specify here any float value from the input system, but it is recommended to leave the PlayablesWeight as a default value.

You can also use this component to preview animations in the editor. Just select your animations and hit the preview button!

Note: the Playables Controller is not added automatically, unlike other components. This is because of the IPlayablesController interface. This one is particularly useful if you have a custom system, like Animancer, which you would like to integrate directly with the framework.

All you have to do is to implement the IPlayablesController interface, and you can use your custom component in the FPS Animation Framework.

Execution order

Lastly, we need to slightly adjust the Script Execution Order in the Project Settings. Go to the Edit/Project Settings/Script Execution Order and make sure to put the FPS Animator before your controller class:

Tip: this step is required for the proper initialization process, so the FPS Animator can process all the mentioned above components.

Last updated