Here we will explain how to use BoneSpring.
This guide continues on how to use BoneCloth.
Therefore, we will skip the items that have already been explained, so please read how to use BoneCloth before reading this guide.
What is BoneSpring?
BoneSpring provides spring sway functionality for Transforms.
This is great for things like a character’s chest shaking.
Another advantage is that the processing load is low because the functions are simple.
Now let’s introduce BoneSpring.
Here we will explain the setup using the sample UnityChanKAGURA’s chest shaking as an example.
First, like BoneCloth, add the MagicaCloth component from the Hierarchy right-click menu.
Then change ClothType to [Bone Spring].
Now you are ready to use BoneSpring.
Registering a Transform
First, you need to register the Transform to be simulated.
In KAGURA, there are pairs of start and end points on the left and right for the chest transform, making a total of 4 transforms.
BoneSpring needs to register the Transform that is the starting point of the hierarchy.
In KAGURA, there are two Transforms: [DB_Bust_01_L] and [DB_Bust_01_R].
Add these two Transforms to RootBones.
When you register the starting Transform, all of its child Transforms are automatically registered as well.
At this point, the gizmo will be visualized in the Scene view as shown below.
Similar to BoneCloth, Transforms registered in RootBones are automatically assigned to the red fixed attribute, and others are automatically assigned to the white moving attribute.
This setting can also be changed by vertex painting.
Vertex paint is available from the green pen mark.
Spring and Pendulum
Let’s explain some important BoneSpring concepts before setting the parameters.
It is the relationship between a spring and a pendulum.
First, the most important feature of springs only works on vertices with fixed attributes.
In other words, it’s just Gizmo’s red Transform.
Fixed vertices in BoneCloth/MeshCloth do not move from the origin, but in BoneSpring they can be swayed.
And the spring effect does not work on the moving vertices of the white gizmo connected from the fixed vertices.
Instead, the moving vertex has an important role as a pendulum.
This is a mechanism in which the moving vertex is shaken by movement, and the fixed vertex is rotated by this fluctuation, as shown in the video below.
Conversely, if there is no pendulum, the fixed vertex will not rotate.
Therefore, the movement may look more natural if there is a moving vertex for fluctuation.
In the sample UnityChanKAGURA, two fixed attribute vertices are set for the spring, and two moving attribute vertices are set for the pendulum extending from there.
After that, you will need to set the parameters and adjust the movement.
However, this process requires some getting used to, so let’s start with a simple setup using presets.
A preset is a file containing parameter settings.
MagicaCloth comes with three presets for BoneSpring.
By using presets, you can easily set up movements that suit your needs.
Presets can be easily added from the [Preset] drop-down menu.
First, let’s set up [MiddleSpring].
The medium strength spring parameters are now expanded.
Once the settings are complete, run it and check it out!
If you move your character during execution and the chest is shaking, you’ve succeeded!
Now let’s adjust the parameters while actually operating it to get it closer to the ideal movement.
Understanding the parameters is essential to getting close to the ideal movement.
Here we will explain how each parameter affects BoneSpring.
Controls the movement of springs at fixed vertices.
You can set the strength of the spring with [Spring Power].
[Limit Distance] is the maximum movement range that can be moved from the origin.
The movement range can be further limited in the normal direction of the vertex using [Normal Limit Ratio].
This allows you to make the movement range an ellipse.
The normal direction of the vertex can be changed with the following parameters.
You can also use [Spring Noise] to make multiple springs desynchronized by noise.
See Spring for more information on spring parameters.
The behavior of the pendulum part, which is the moving vertex, is controlled by two panels: [Angle Restoratio] and [Angle Limit].
You can set the restoring force and angle limit of the pendulum part.
The operation of these two panels is the same as the previous BoneCloth/MeshCloth.
See AngleRestoration and AngleLimit for details.
Increasing [Damping] increases the resistance at the apex and applies the brakes.
By increasing this parameter, it is possible to quickly converge the vibrations of the spring and pendulum.
Inertial panels also play an important role in BoneSpring.
If the movement of the character causes too much shaking, it is also important to lower the inertia parameter to reduce the effect of movement.
See Inertia for details.
Unlike BoneCloth/MeshCloth, in BoneSpring, vertices are basically not subject to collision detection.
If you want to add collision detection to a vertex, you need to separately register the target Transform in [Collision Bones].
Transforms must exist in the hierarchy below RootBones.
Once registered, the gizmo changes to a filled sphere, and collision detection can be performed using a collider.
Also, BoneSpring’s collision detection is special and limits the distance it can move from the origin.
This can be adjusted with [Limit Distance].
The repulsive force on the collider will then automatically decrease depending on the distance.
BoneSpring is affected by wind.
If you want to reduce the influence of wind, lower [Influence].
See Wind for details.
You can control which direction each fixed vertex and moving vertex Transform ultimately rotates.
These two are very important in BoneSpring.
See RotationControl for details.
BoneSpring is the same as BoneCloth/MeshCloth except for the spring movement, but some functions are limited.
Also, some parameters are hidden and their values are automatically set.
- Transform connections are fixed in Line mode
- Gravity is automatically disabled
- Custom skinning functionality is not available
- Backstop functionality is not available
- Self-collision functionality is not available
- Collider collision is fixed to Point mode
- Collision detection is basically disabled for Transform
- Transforms for which you want to perform collision detection must be registered separately
- Shape restoration parameters are hidden and automatically set for BoneSpring