Skip to content
DogeThis edited this page Dec 25, 2024 · 18 revisions

Setup

First, make sure you're using the latest version of the Engage Unity template.

Additionally you should familiarize yourself with setting up custom bundles before attempting to incorporate springbones into your models.

This guide will not cover how to set up collisions on a model.

Getting started

You should have a UTJ tab available in the unity editor to open the spring bone window - it's useful to dock this window for easy access. image

Model Prep

Before setting up spring bones in Unity you should ensure that your model is set up correctly for the spring bones to behave normally. IF you are not using bones from a vanilla FEE model there's a good chance you will need to make some adjustments. This guide will be using Blender 3.5.1 for this step.

Checking bone axes

First you should enable bone axes display under the viewport settings of your model's armature

image

Make sure that the chain of bones you want to act as a spring bone has consistent bone axes otherwise the spring bone may behave erratically. If your bone chain has misaligned axes like the below image you can correct them either by copying the roll value from the parent bone down to the children or by recalculating the roll. image

To recalculate the bone roll select all of the bones in the chain and navigate to option in the menu or hit Shift + N image After recalculation:

image

Adding end bones

Unity uses the children of a node for various springbone calculations, so you should add an end bone to the end of any springbone chain to avoid errors You can add a child bone simply by selecting the tail of the last bone in the chain and extruding with the E key

image

image

You can align the axis of the newly extruded bone and rename it to indicate it is an end bone

Adding Spring Bones to your model in Unity

Springbones are added as script components on the transform nodes of a prefab and can be added from the inspector using the add component button

image

image

image

For a chain of springbones each node will need a springbone component added. You can select all of the nodes you want to add springbones to so that you can add the springbone component to all of the nodes at one time

image

In addition to the springbone components a group of springbones needs a springbone job manager component added on a parent node

image

image

Configuring springbone properties

For a springbone component the properties can be configured to control the behavior of the springbone. It's important to configure these values to prevent clipping and ensure the bone moves smoothly

The primary properties of a springbone are the force values and angle limits

image

Force Attributes

To configure force attributes correctly it's important to understand what each value affects in the springbone's behavior

Stiffness - Stiffness controls how resistant the springbone is to motion. A higher stiffness value is appropriate for springbones that shouldn't move much and the first bone in a springbone chain. A high stiffness value that will result in very little movement is 100 A low stiffness value that will not resist movement is 0.1 For a chain of bones you can iteratively decrease the stiffness by half of the prior value to achieve a chain of bones that is moves smoothly without being too stiff throughout or too loose at the root bone

Drag - Drag controls how the springbone is affected by air resistance. A bone with high drag will get pulled back as a character moves forward while a bone with low drag will not. You should keep drag force low on any bones that are on the front of the character model so that they will not get dragged back into the character's body. Inversely, a high drag value can be used for bones behind a character that should flow along with their movement from behind them. A drag value of 0.1 or lower is best for springbones in front of a character A drag value between 0.1 and 1 can be used elsewhere it's best to keep drag at a consistent across a chain of springbones

Spring Force - The spring force setting doesn't appear to affect springbone behavior in any meaningful way. It is set to Y -0.0001 all vanilla springbones I have checked, so that's a safe value to use

Wind Influence - This value is self-explanatory, it affects the influence that wind forces have on a spring bone. If the spring bone represents a something heavy that shouldn't blow in the wind a low value or 0 should be used

Angle Limits

Angle Limits - Angle limits dictate how far a spring bone can rotate in relation to the pivot bone for both Y and Z axes. Limits need to be enabled and assigned min and max rotation values. To visualize the limits you should select the pivot node for the respective springbone and look at the axes of that node

image

You can confirm the rotation axes by checking the rotation gizmo for your pivot node. you can change to a rotation gizmo with the E or Y key in Unity

while facing an axis directly clockwise rotation is positive and counterclockwise is negative

image

So in this example the Y axis rotates the skirt bone down with positive values and up with negative values, so angle limits can be set accordingly to prevent much rotation on Y axis positive so that the skirt won't clip into the legs

Other Properties

Pivot Node - A separate transform node must be assigned to this property so that the spring bone will rotate correctly. You can create pivot nodes using the Spring Bone Window, which has a create pivot button

This button will create a pivot node for the selected bone.

image

After the pivot is created, it should be assigned to its corresponding bone automatically. If not, you can drag and drop it to the Pivot Node property from the hierarchy view

image

Warning

If you're using a bone chain from an FEE model that already has pivots, you should delete the original pivot bones and create new ones, because the FBX import/export process may modify the bone axis settings of the pivot nodes

Collision Radius - Collision radius determines the size of the collision node for a spring bone. Even if colliders are not created a bone can still collide with the ground, so this value needs to be set. 0.05 is a good radius for a reasonable collision sphere.

Enable - This checkbox doesn't seem to affect any spring bone behavior. Even if it is unchecked a spring bone will still function

Adding Spring Job Managers to the prefab hierarchy

Spring bones in Fire Emblem Engage are handled by a Spring Bone Job Manager that is added on a root bone above the spring bones in the hierarchy.

image

image

The job manager controls several attributes that apply to all of the spring bones that it manages.

Adding Spring Job Managers

A spring job manager can be added with the add component button in the inspector or with the create/update manager button from the spring bone window The manager should be added on a root bone above the spring bones in the hierarchy.

Spring Job Manager Properties

All attributes of the manager will default to 0, so they need to be updated for the manager to function.

Populating the list of spring bone attributes

Important

The Update Spring Bone List was removed in a recent update to the tools. Updates will happen automatically now whenever you change something. If you are still seeing the button, you should update your template.

The list of spring bones under the manager will initially be blank. Details can be populated automatically from the child bones using the Update Spring Bone List button.

image

image

image

In case any of the properties of the child spring bones are changed you will need to use the Update Spring Bone List button each time

Setting up the spring job manager properties

The list of properties under the spring job manager before the sorted bones table are properties that will affect all bones under the job manager

image

Simulation Frame Rate - This property controls the framerate of the spring bone simulation. A spring bone will calculate its position this many times per second. This value is set to 60 in most vanilla bundles even though Engage targets a framerate of 30. The game most likely has a script that controls physics framerate based on LOD so this setting may not matter.

Dynamic Ratio - This property amplifies or reduces the overall force values applied on the child bones. A value of 1 is the default setting - Higher values can result in jerky movement, but can be used for to make a spring bone move quickly.

Gravity - The gravity property controls persistent force on the spring bone to simulate the effect of gravity. It usually has a value of Y -10, but different values can be used. For example, engage outfits have cloth bits that float upward, these use a positive Y value for gravity.

Bounce - This setting controls bounce-back force on a spring bone. Most vanilla bundles use a value of 0, but this setting does work in Engage, and can be used when setting up bouncy physics such as bust physics

Friction - Friction controls damping for spring bone movement. A low friction results in a spring bone which stays in motion for a longer time and inverse for high friction.

Time - Set this value to 0. Most likely this is a container that the game uses during runtime, so the setting in Unity shouldn't matter, but it defaults to 0 anyways so best to leave it be.

Wind forces

Engage simulates wind independently for each spring job manager and it's controlled by several properties

Wind Disabled - disables wind for all bones under the manager

Wind influence - modifies the overall influence of wind on the spring bones. 1 is the suggested value

Wind Power - controls what direction - and how far - wind will move the spring bones. For cloth a value of X 30 Y 1 Z 1 is consistent with vanilla outfits, but clothes with special physics such as engage outfits will have different values.

Wind dir - controls rotation of the wind. Vanilla outfits usually use x 0.3

Distance Rate the rate at which the wind will blow - lower values result in consistent wind that blows at full power continually while higher values will blow sporadically at low wind power. A value of X 30 will result in a sway between 0 and maximum distance and is consistent with vanilla outfits.

Automatic Reset - These settings control whether the bones will return to their original positions, counteracting wind influence. This setting is required for bones to sway with the wind. Reset distance and angle affect how deformed the bones can still be when resetting position. A setting of 1 for distance and 60 for angle are typically used

Job Properties - Important note for bone chains

This section contains details for the spring bones under the job manager most details are automatically populated without issue, so these fields may not need to be modified.

If a job manager has a chain of connected bones, the parent index and pivot index attributes need to be set in the following way.

Note

This should be automatically handled by the Spring Bone tools, but is described here for clarity.

image

All bones need to be set to match the element number of their parent in the sorted bone list.

If the indices are -1, they need to be fixed manually.

For example, in the below list of bones Ribbon_R_002_DR is a child or Ribbon_R_001_DR, so the parent index and pivot index needs to be set to 1 (the element number for Ribbon_R_001_DR in the sorted bone list).

image

Exporting/Importing Spring Bone CSVs

v8 of this tooling allows you to export and import Spring Bone settings and pivots as a CSV file.

image

This can be useful for quick editing, backing up your work, or evening transferring Spring Bone data when you're importing a new version of your model.

Important

You should only use this feature when you changed parts of your model that aren't related to the Spring Bones themselves. If there are new or missing bones, or moved bones, the restoration may result in unexpected results.

To save bone information,

  1. Open the Spring Bones window with UTJ -> Spring Bones Window if not already open.
  2. Select the GameObject that has the Spring Job Manager that has the bones whose data you want to save.
  3. Under Dynamics CSV, use "Save", then "Save CSV"
  4. You will now have a CSV file with the Spring Bone information. Here is an example

To load bone information,

  1. Open the Spring Bones window with UTJ -> Spring Bones Window if not already open.
  2. Select the GameObject that will be the manager for the bones whose data you want to load.
  3. Under Dynamics CSV, use "Open", then "Load CSV and Setup", and pick the CSV you want to restore.
  4. The tool will attempt to make the manager, the spring bones, and the pivots as described in the file.

Note

For how to save and load spring bone information as a CSV, see this guide

Note

For how to copy spring bone information from another bundle, see this guide

Troubleshooting

In case of issues or strange behavior with your physics bones there are several troubleshooting methods to consider

Check for empty children

If you're getting errors in the console the script may have added a child node under a spring bone that was later deleted. This results in an empty row in the valid children property for that bone, but this property is not visible in the inspector by default To resolve this issue first click the checkbox to show the original inspector

image

This will append an unformatted list of properties which does contain the valid children property. If you have an empty row in this property table remove it with the minus button

image

Confirm pivot bone rotation and position with gizmos

If spring bones are behaving erratically there may be issues with the rotation of the pivot bones. To diagnose the issue you can click on the spring bone in the hierarchy view and check the placement of the gizmo in the scene view

image

The location of the pivot should be the same as the spring bone, but the rotation will differ. The proper rotation of a pivot node will align the x positive axis with the y negative axis of the spring bone. This means that the red arrow of the gizmo for the pivot node will be the opposite direction of the green arrow of the gizmo for the parent node.

Ensure the root of the hierarchy is not scaled

If you aren't seeing physics in game in spite of properly set up spring bones there may be an issue with the scale of the prefab in Unity. If the root node of a prefab has a scale other than 1 then the spring bone scripts will create pivot nodes which are also scaled and physics will not work properly. You can confirm this is an issue if the pivot nodes created by the script have a scale other than 1. To fix this issue check the root node of the prefab and set all of the scale values to 1, then delete and re-create the pivot nodes for all of the spring bones.

Sample project

If you want a sample project to study, check out the Pyra costume project, which was made following this guide!

Clone this wiki locally