en:vrm:setting:spring

Configure swingable parts in VRM

By configuring swingable parts in a VRM model, you can swing hairs, skirts or anything.

For detailed specification on VRM, refer to VRMSpringBone.



Make hairs swingable

For this example, let's make hairs swing.


When you place a VRM model in Scene and see the Hierarchy, you will see an object called “secondary.” Click and select it.


Open the Inspector pane. You will see a script called “VRM Spring Bone.”

“Root Bones” property is the place to specify the bones to swing.

Expand the Root Bones to see Size property. For this example, set 2 in the Size.



We would like to swing hairs, so for “Element 0” and “Element 1”, set “hair3_L” and “hair3_R” respectively.



Click on the (1) Play button and click on (2) Scene button.
From the Hierarchy, select the parent Alicia_solid, and move it in the Scene. You can see the spring physics is applied to the hairs.





Collider

We must specify colliders to avoid the hairs from penetrating through the body.
For this example, we will set colliders on arms to avoid hairs from penetrating them.

From the Hierarchy, select “elbow_L” and in the Inspector click [Add Component].


Type “springbone” in the search box to see two results. Select “VRM Spring Bone Collider Group.” Do the same for “elbow_R” as well.



In the Hierarchy, select the “secondary” again. In the Inspector, expand the “Collider Groups” and in the “Size”, type “2.” On “Element 0” and “Element 1,” set “elbow_L” and “elbow_R” respectively.
Click on the Play button at the top of the screen again, then click on the Scene tab.
Now, in the Inspector, let's try changing the value of “Hit Radius” under Collider.
In the steps before, we have set the colliders on the elbows, then on the Spring Bone setting, we set it to collide with the colliders on elbows.
By making the value of the Hit Radius larger, the size of the collision detection area gets larger. When the value reaches a certain point where the colliders start to collide with the hairs, you should see the hairs being pushed against the colliders.




About the parameters

Here we will briefly explain three parameters of the SpringBone that control the behavior of swingables.


Stiffness Force

Stiffness of the object. It specifies how hard the object tends to go back to its original position.



Gravity Power

Specifies the strength of the gravity.



Gravity Dir

Specifies the direction of the gravity.



Drag Force

Specifies the resistance. Higher value makes the movement dull; lower value makes the movement light.



en/vrm/setting/spring.txt · Last modified: 2024/08/19 14:24 by pastatto

Page Tools