# Input System

## Overview

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:

<figure><img src="/files/OfGU84KbhMWYUV6sfakF" alt="" width="401"><figcaption><p>Example input config asset.</p></figcaption></figure>

Once the game starts, the **User Input Controller** will register all the properties from the **Input Config**, so they can be modified in runtime. So far only 4 types are supported:

* Int
* Float
* Bool
* Vector4

{% hint style="success" %}
**Tip:** floats have an interpolation feature. Set the interpolation speed to something higher than 0, and the system will automatically interpolate the value in realtime. This is a useful function for weights, when you want to smoothly disable/enable some animation features.
{% endhint %}

The framework provides a default **Input Config**, which you can use as a starting point:

<figure><img src="/files/SzAZ5cXgKbwuvPdXt2Jp" alt="" width="347"><figcaption><p>Default asset.</p></figcaption></figure>

To get or set values in runtime, you can use these methods:

```csharp
// Where T is your custom type.

public virtual T GetValue<T>(int propertyIndex)
public virtual T GetValue<T>(string propertyName)

public virtual void SetValue(string propertyName, object value)
public virtual void SetValue(int propertyIndex, object value)
```

While it is possible to get/set a property by name, it is recommended to use the property index instead. You can get the property index in the **Start()** event like this:

```csharp
private UserInputController _inputController;
private int _myPropertyIndex;

private void Start()
{
    _inputController = GetComponent<UserInputController>();
    _myPropertyIndex = _inputController.GetPropertyIndex("yourPropertyName");
}
```

Now let's learn what parameters control what in the default Input Config.

## Default Properties

### Float properties

* **PlayablesWeight** - controls the weight of the custom animations.&#x20;
* **StabilizationWeight** - controls the stability of the upper body. If set to 1 - fully stabilized, if 0 - overidden locally, stability is not guaranteed.&#x20;
* **LeanInput** - defines the lean angle. Used in the Look Layer.&#x20;
* **Aiming Weight** - controls the weight of the ADS. It is modified in the Ads Layer, and used in the View Layer.
* **TurnOffset** - controls the character rotation offset to counter player rotation (it is used sed for turning in place).

### Bool properties

* **IsAiming** - defines the current state of aiming.&#x20;
* **UseFreeAim** - whether we use the dead-zone mechanic or not. Only used in the Sway Layer.-

### Vector4 properties

* **MouseInput** - defines accumulative mouse look input. X is the yaw rotation, while Y is the pitch rotation. Z and W components are not used. Primarily used by the Look Layer.
* **MouseDeltaInput** - defines the delta mouse look input. X is the yaw delta rotation, while Y is the pitch delta rotation. Only used by the Sway Layer.
* **MoveInput** - defines the current movement input. X represents the horizontal movement, and Y - is horizontal. Used by the Sway Layer.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
