Last updated
Last updated
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.
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.
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.
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.
Subscribing the object to the Motion Manager gives the developer access to the , which is then used to produce procedural motion effects.