Scaling at runtime


From v1.7.2, scaling is possible at runtime.
Also, from v1.7.6, minus scale (flip) is possible.
However, there are some restrictions.
Here are the restrictions and points to note when scaling.


Restrictions by Unity version

When using Unity2019.2.13 or earlier, the following restrictions will occur for scaling.
There are no such restrictions when using Unity 2019.2.14 or higher.


Impact on performance

In Unity2019.2.13 or earlier, scaling acquisition of Transform can be done only in the main thread.
This means that you cannot benefit from the Job System + Burst compiler.
Therefore, there will be some performance degradation in proportion to the number of bones (Transforms) used in the cloth component.
This load can be confirmed with [Read Bone Scale] of the profiler.

With Unity 2019.2.14 and above, there is no such performance degradation.


MagicaPhysicsManager Settings

To enable runtime scaling in Unity2019.2.13 or earlier, [Update Bone Scale] of MagicaPhysicsManager must be turned ON.
Please note that runtime scaling will not work if OFF (default).

Also, this is now affecting the entire world.
Please note that you cannot specify each cloth component individually.
In Unity2019.2.14 and above, this designation is unnecessary and will not be displayed.


Constraints by MagicaCloth data version

In order to do runtime scaling, MagicaCloth needs scaling data.
Therefore, it is necessary to create the data with MagicaCloth 1.7.2 or higher version.

If the data is old, a warning will be displayed in the inspector as follows.
You can ignore this warning, but note that runtime scaling is not enabled.

If you press the [Create] button to create the data again, this warning will disappear.


Scaling constraints

There are some restrictions on character scaling.
Basically, there is no problem as long as you perform uniform scaling.
Next is another limitation on the scaling state.

Status constraint description
Uniform scaling There is no particular limitation when scaling xyz uniformly.
Uneven scaling If you scale xyz unevenly, the collision decision cannot be calculated accurately.
Negative scaling
Negative scale is limited to one axis in xyz.
It is not possible to set more than one axis to negative scale.


Simulation behavior during scale

The cloth simulation after the scale takes over the movement of the simulation before the scale (100%) as it is.
For example, even if you enlarge a character by 10 times, the appearance of the cloth simulation for that character will not change from that at the normal size.
It is the same when reducing.

Therefore, even if the 1m cloth is expanded to 10m, the operation will be different from the actual 10m cloth.
This is set like this assuming that it is used in games rather than realism.


Scaling judgment

The cloth component uses the [Influence Target] bone of the [World Influence] parameter to determine scaling.
In other words, the scale of the bone specified here is seen and reflected in the simulation.
If [Influence Target] is (None), the Transform of its component is referenced.