Spring Bone Colliders - DivineDragonFanClub/Lythos GitHub Wiki

Introduction

This page will cover the use of Colliders for Spring Bones along with the difference between Spring Manager and Spring Job Manager. For more information on Spring Bones including the basic setup and model prep check the Spring Bone page.

What are Colliders? Colliders are virtual shapes which collide with or stop spring bones, these are very useful thing things like a dress where you don't want the legs to clip into the dress and instead push it out of the way. However there's also many cases where you'll want to avoid using them and rely on rigging and model shape to reduce clipping, we'll get into why a bit later.

Spring Job Manager vs Spring Manager

Spring Job Manager is the main component we use to manage Spring Bones, this is from a custom fork of the original Spring Bones plugin to take advantage of Unity's Job system making it multithreaded and fast. Spring Manager is the original manager component that does not support multithreading.
Why is the relevant? While both Spring Managers support collision in Intelligent Systems' fork of Spring Bones Job collision doesn't work correctly and will not animate with a model making them fairly useless. Spring Manager, and it's Spring Colliders, still work properly however.

Due to the nature of this minor problem this makes using Colliders unoptimized as they cannot make use of the Job system's multithreading. and it's not recommended to use colliders in most cases if you can handle it via other means like rigging, spring bone parameters, or the mesh shape itself. Colliders and the Spring Manager itself are never used in any of the game models except for one somniel outfit. most likely by mistake, and even that model only uses the Spring Manager with no Colliders.

[!WARNING]
This guide will continue on using the Spring Manager component, please only continue if you have no other choice but to rely on colliders.

Converting from Spring Job Manager to Spring Manager

Luckily this step is easy, the custom spring bone fork we use already has a function for converting Spring Job Manager back to a Spring Manager. This function is mainly used for in unity editor previewing of models and spring bones but we can make use of it here.
While in you model Prefab, select the node with your Spring Job Manager component, open the UTJ tab and Revert the SpringBones for the selected GameObject.

Remember to ONLY use this on the managers you need the bones to use Colliders. A model can use a mix of both Spring Job and non Job Managers, so to keep things optimized only revert where you need it.

[!IMPORTANT]
Make sure in all your Spring bones the Enable parameters is True, this doesn't matter for Spring Job Manager but it does for Spring Manager, if your spring bones are not enabled they WILL NOT MOVE.

Spring Colliders

Spring Colliders come in 3 different shapes, Capsule, Sphere, and Plane, each has their own use cases but all will function but this guide will mainly use capsule as those are the standard.

Adding Colliders

To add a Collider to you model first find the bone you wish to use, these are bones you want you spring bones to collide WITH not the spring bones themselves. I will be using l_leg1_jnt and r_leg1_jnt or the thigh bones. Select the bones you want and then open the Spring Bone Window, at the bottom you'll see the Collisions section and options to add the different types of Collision. choose which one you want to use, this will create a new sub GameObject with the correct collision component.

You can also adjust the size parameters of each collider in the inspector tab, make sure the shape is big enough to cover what you want to collide.

Colliding with Spring Bones

To setup which colliders you want your bones to collide with first select the Manager GameObject and in the Spring Bone Window press "Select child Spring Bones" this will select all the bones that Manager is setup to manager making it easy to bulk edit these bones.
at the bottom of the inspector tab in the Spring Bone component you'll see a Collision Detection section. here there's a couple different parameters to make use of.

First you'll want to adjust the Radius value, this controls the size Spring bones collision aka how close the Spring Bone can close to you Collider before they actually start to collide, these are visualized by yellow spheres in the preview window. adjust them to your liking making sure they're not too big but also not so small they cause clipping.

Second you want to add entries to the collision lists, in my case I'll add 2 entries to "Capsules". With those added you can either use the circle with a dot to pick the colliders from a list of objects in your scene or you can drag and drop from the Hierarchy tab into the list entries.
With that you're done, Collision is all setup.

Closing Notes

As mentioned earlier there's 3 different Collider shapes, the uses of these vary but in general Capsule is the default that's used for many bones either one limbs like arms and legs or inside the torso one the spine bones going across. Spheres are good for things like feet or hands not something you need need something long like a Capsule, they're also used commonly in breast physics. Planes are mainly used for making a virtual ground collider.