Motion Manager
Last updated
Was this helpful?
Last updated
Was this helpful?
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 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.
To subscribe an object:
Add a new component to the object.
Create a value for the properties that can change (pos, rot, scale).
Keeping a private 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:
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:
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.
Subscribing the object to the Motion Manager gives the developer access to the , which is then used to produce procedural motion effects.