Physics Manager

Physical manager

PhysicsManager is a manager that manages the entire Magica Cloth component.
One is required for each scene.

Place in scene

In order for MagicaCloth to work, the MagicaPhysicsManager needs to be placed in the scene.
It is already prefabricated, so place the next prefab in your scene.
Also, be sure to place the prefab on the Hierarchy route (see below).

 

Property

Set the frequency of updating the physics engine of MagicaCloth.
Basically, there is almost no problem with the default settings, but there are cases where it is advantageous to adjust the settings for the project in terms of performance.

Item Description
Enabled You can stop the entire MagicaCloth operation by turning off the Enabled flag of the component.
Update Per Second Number of physics engine updates per second.
The more updates, the stronger the physics engine, but at the expense of performance.
The default setting is 90 times.
Update Mode

Update time method.

[Unscaled Time]
Updates are performed regardless of the Unity frame rate.
Useful when the frame rate fluctuates during the game.
However, the physics engine may be executed multiple times in one frame, and this will cause a wave in performance.

[Once Per Frame]
Updates are made only once per Unity frame.
In this case, the physics engine advances by the time step of [Update Per Second] with one update.
If the frame rate is almost constant during the game, this is a performance advantage.
When using this mode, [Update Per Second] needs to be adjusted to the frame rate of the game.

[Delay Unscaled Time]
Delayed execution.
Update is the same as Unscaled Time, but also runs the Cloth simulation while rendering.
This greatly improves performance.
But note that the result is one frame late.
This delay is interpolated by future prediction.

Update Location

The update position of the simulation.
[After Late Update]
The simulation will be updated after Unity’s LateUpdate ().

[Before Late Update]
The simulation is updated before Unity’s LateUpdate ().
This is useful when used with assets that are updated with LateUpdate (), such as the 2D Animation Package.

Faster Write

By turning this option on, Render Deformer will use Unity’s new Mesh API to update the mesh vertices.
This will significantly improve the mesh update speed.
However, this function can only be used with Unity 2021.2 or later.
The default is OFF.

OnPreUpdate

It is possible to register the event before executing the cloth-simulation.

OnPostUpdate

It is possible to register the event after executing the cloth-simulation.

 

Manager is not destroyed

The PhysicsManager is set to not be deleted when the scene is destroyed.
Basically, by placing it in the scene that will be loaded first in the game, it will always be active during the game.

However, be sure to place the manager in the root hierarchy of your scene to enable this feature.
This feature cannot be used if the manager is not placed in the root hierarchy.

 

The second manager is destroyed, but the settings are copied

If a second manager is found, it will be destroyed.
However, that manager’s settings are overwritten by the current manager.

 

Delayed execution

By setting UpdateMode to [Delay Unscaled Time], the cloth simulation will be executed even during rendering.

This can greatly improve performance, but note that the result is one frame later.
However, this delay can be interpolated by future prediction.

Item Description
Future Prediction Rate Future prediction rate.
At 1.0, the future prediction is performed up to one frame ahead and the result is interpolated.
0.5 predicts the future up to 0.5 frames ahead.
If set to 0.0, no future prediction is performed.

Next is a comparison image of the future prediction.

Without future prediction With future prediction

In the left image, the foot passes through the cloth because it is delayed by one frame.
However, the image on the right does not penetrate because it is interpolated by future prediction.