> For the complete documentation index, see [llms.txt](https://unfinishedstudios1.gitbook.io/fp-motion/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unfinishedstudios1.gitbook.io/fp-motion/components/motion-manager.md).

# Motion Manager

## Description

The *Motion Manager* script is the main component in the asset, it does the following things:

* Keeps track of objects and the forces applied to them.
* Makes sure the forces affect those objects.
* Allows developer's easy access to those objects.

Every object that needs to have a [Spring System](/fp-motion/components/spring-system.md) will have to subscribe itself to this component at the start of the game; that way the *Motion Manager* will take care of calculating its rest point for further spring calculations.

{% hint style="info" %}
If an object doesn’t subscribe to the *Motion Manager*, the spring calculations will not work and thus the object will not move, neither will it have a Handle.
{% endhint %}

## Usage

To subscribe an object:

1. Add a new component to the object.
2. Create a [Spring Data](/fp-motion/data/spring-data.md) value for the properties that can change (pos, rot, scale).
3. Keeping a private [Handle ](/fp-motion/components/untitled.md)value; This value is the bridge between the component and the Motion Manager.

Here is what the code would look like by following those steps:

```csharp
// Component place on the 'A' GameObject.

//This variable is used to control how this object's translation will look.
[SerializeField]
private  SpringData  translation;

//The bridge value that connects this component to the Motion Manager.
private  Handle  handler;

//Start can be used, but Awake is better for most cases.
private  void  Awake(){
   //Use Subscribe in order for the Motion Manager to keep track of this object.
   handle = MotionManager.Subscribe(transform, translationData);
}
```

The object can **receive forces as inputs**, and its position will change; here's what a force to move the object up might look like:

```csharp
private  void  Update {
    //Use Translate to move the object. (Value isn't exactly what is passed)
    handle.Translate(Vector3.up);
}
```

#### **Why subscribe an object to the manager in the first place?**

Subscribing the object to the *Motion Manager* gives the developer access to the [Handle](/fp-motion/components/untitled.md), which is then used to produce procedural motion effects.

We had the system work this way to **keep track of the current springs** in a game, which allows the developer to stop any of them, or add more.

{% hint style="info" %}
Usually, we will place this component on the player, or on a Manager object, and leave it there for other components to use during play mode.
{% endhint %}
