Generating colliders on characters

Note: This feature is currently in beta. Learn more about our beta program here.

When setting up new characters, the Flipside Creator Tools will generate physics colliders for your characters to be able to interact with the virtual environment. This also helps prevent a character's parts from intersecting with each other, such as an arm disappearing into a character's side.

Contents

Basic collider setup

The colliders are added to a character via the GenerateColliders component that is added to the root game object of a character in the Unity scene hierarchy, below the AvatarModelReferences component.

Here's how they look on a new character, with the GenerateColliders component shown beside them.

GenerateColliders component

Customizing your colliders

When customizing your colliders you will want to repeat steps 1 and 2 until you are happy with the results being generated. This is because any changes made to colliders that are generated by the system will be lost on subsequent generations.

Step 1. Add to exclude list if needed

When the Generate Collider button is pressed the system will process all bones on the avatar generating colliders for any bone that has vertices associated with it. In some instances you might not want colliders on a specific bone or the colliders being generated are incorrect so you will be adding colliders to them manually after generation. In these cases you will want to add the bone to the Exclude Transform List.

Identifying transforms to exclude

The pelvis, shoulders, and eyes have extra colliders we don't need.

To do this all you have to do is drag the bone to exclude from the Hierarchy window onto the Exclude Transforms text in the Inspector and it will add it to the list. You can also increment the size by one and then drag the bone from the hierarchy to the empty space on the list.

Exclude transforms list

Continue adding all the bones you wish to exclude then hit the Generate Colliders button at the end to have the system regenerate ignoring the bones you excluded.

Step 2. Add to override list if needed

By default the system will use Humanoid as the default body. The default body type sets arms, legs, fingers, and the head as capsule colliders. Everything else is set to use box colliders. If you wish to have the system use a different collider on a bone you will need to add that bone to one of the override lists.

To add a bone, find it in the hierarchy window and drag it to capsule, sphere, or box under the Collider Overrides section. Drag it over the name or increment its size by one and drag it to the ope space as you did with the exclude list.

Capsule Transforms list

Repeat this for every bone you want to change. After doing this hitting the Generate Collider button will regenerate your colliders using the collider types you specified.

Step 3. Tweak or combind generated colliders

The system will do its best to try and size the colliders based of the vertices associated with each bone. Sometimes it has difficulty determining the best shape. In these instances, click on the collider and make changes to its size and position to help it better fit the body part.

Make sure your changes are mirrored on both sides of they body. One way to make this easier is to make your adjustments on one side then use Copy Component and Paste Component Values. These are available under the gear icon of each component.

a) First click on the gear icon for the component you just made changes to and choose Copy Component.

Copy component

b) Next, go to the component on the opposite side and click on the gear icon. This time, choose Paste Comonent Values. After doing this, you might have to inverse the x or y position and possibly the rotation so that it lines up correctly.

Paste component values

When dealing with arms, fingers and legs, make sure that the joints don't overlap. If you find the generated colliders do overlap, tweak them until they are just barely touching one another. The only exception to this is if you have a character that does not match standard human proportions. In these instances, you might want to have more or less overlap and will require some testing to determine what settings work best.

Colliders - Arm setup

It's okay to have overlap in other areas like the head or spine/chest. The best practice if you are going to have overlap is to ensure the colliders are all on the same bone. This avoids the rigid body trying to pull itself apart during simulation.

Note: Feet will always be boxes and have bounds that do not go below the floor.

Step 4. Add new colliders for more detail

If you find that the generated colliders are not meeting your needs, you may also add colliders of your own. This can be done before or after generation. All collider types are supported, but mesh colliders must be convex. With any solution, you will want to try to use mostly primitive collider types and try to limit the number used for performance reasons.

Colliders - head setup

Step 5. Save and test

Once all the colliders are setup correctly, build your character and upload it via your Flipside dashboard. When the character is imported into Flipside, the physical body will be setup so you can interact with the environment. If you load an old character or remove the GenerateColliders script from the character, it will default back to the old system and your limbs will pass through physical objects.

Advanced collider customization

Default body

The default body defines which colliders are used for various body parts prior to overrides. By default humanoid is selected, but if you have a character that is unique you can change the default body. The options available are:

  • Boxes - Set all colliders to boxes
  • Capsules - Set all colliders to capsules
  • Spheres - Set all colliders to spheres

The system will still try to make the shape you choose fit the vertices but will force all the colliders to a specific type before overrides are applied.

Dfeault collider types

Size multiplyer

This is a scale value which will increase or decrease the size of all generated colliders by a fixed amount. For example, if you set it to 0.95, all the colliders would be 95% of their calculated size.

Layers

Each vertex can be influenced by up to 4 bones. Typically the first bone (or Layer) is the primary driver of the vertices mapped to the bone. This is why we have only Layer 1 selected by default. If you find that not all vertices are getting colliders generated, you might want to experiment with adding layers by checking them before hitting Generate Colliders.

Note: You will likely get many more colliders that don't exactly match the body parts and it will take more work to clean them up.

Bone weight layers

Adding colliders to existing characters

To add colliders to a character that was created before Flipside supported colliders, open the character's scene in Unity and select its root object in the hierarchy.

In the inspector window, click Add Component and select GenerateColliders. Finally, click on the Generate Colliders button at the bottom of the component. You should see the colliders added to your character in the Scene window.

From here, follow the steps under customizing your colliders above.

Troubleshooting

Scale issues

If you have issues where the character is not loading correctly in Flipside or the colliders being generated don't match the body, then your FBX likely has a scale set incorrectly.

The scale of all the bones and root should be set to 1. If they are not, you need to change that value in Unity using the FBX import settings.

To do so, copy the non zero scale value from the bone and paste it into scale under the FBX import options. Once the scale is changed, click Apply then select the FBX and choose "Create Character from Selected Model" under the Flipside Creator Tools menu.

This should re-import the character at the correct scale. Once that is done you can reset the scale on the model back to 1 if it isn't already then proceed with the standard setup.

Hand/leg colliders not capsules

If you have the default body set to Humanoid and find that the capsules being added don't map up as you expect, it could be due to the bones not being set correctly on the import settings. Click on the model file in the Project window, then select the Rig tab and make sure Animation Type is set to Humanoid, the Avatar Definition is Create From This Model, then hit the Configure button.

Unity humanoid rig

In this screen you will want to go through and make sure the arms, fingers, and legs are mapped to the correct bones.

Unity bone configuration

Colliders generated for some bones are wrong size and shape

To get the best results from our collider generation tool, you will need to make sure that the bones are oriented towards their children. This is standard practice, but some programs such as DAZ Studio will export bones that are not oriented towards the next bone in the chain and will cause problems as a result.

There are various documents on exporting from DAZ Studio to other programs to ensure the bone orientations are exported correctly. If you don't have the option to export again, you might have to fix your model manually.

Not generating colliders for some vertexes

This can be due to the vertices not being available on the default bone layer. Check the layer section above for info on generating with other layers.


Next: Adding movement to hair, cloth, and tails

Edit this page.
This documentation was generated by the My App Documentation Project. We're always open to new contributions *wink* *wink*