Ligamen

Constraints

Physics constraints

A physics constraint adds a spring to a bone. After the bone has its animated pose, the constraint lets it lag behind the motion of its parent, swing past the pose, and settle back. That is how hair sways when a head turns, how a tail trails a running body and how an antenna wobbles, without a single key for the secondary motion. This article shows how to create a physics constraint, what the rows of the Constraints panel do, how the channels and the six spring values shape the motion, how the global physics track and Mix work, how to key values in Animate, and what Warm Up, Physics and Reset do in playback.

A physics constraint in the Constraints panel

How a physics constraint works#

A physics constraint simulates one bone. It reads the pose that the animation gives to the bone, moves the bone as a spring would, and blends the result into the pose with Mix. The motion is applied to the channels that you switch on: X, Y, Rotate, Scale X and Shear X. Each channel has a share, so a bone can swing fully in rotation and only a little in X.

The editor simulates from the start of the animation in fixed steps, so the pose at a given time does not depend on how you got there. Playback, scrubbing back and forth, frame export and the command line all give the same picture. Like every constraint, a physics constraint is solved in the shared order of the Constraints panel (see IK constraints). In Setup and in a paused Animate the simulation also runs live: drag the root bone, and the bones with physics lag, swing and settle. Nothing is keyed by that preview.

Creating a constraint#

Select a bone, right-click it in the Tree, choose New and Physics Constraint. The constraint simulates that bone and starts with the Rotate channel at 100%, because rotation is what most secondary motion needs. If you right-click a group of selected bones, one constraint is created for each bone. A new constraint is named Physics constraint, Physics constraint 2 and so on, and it is added at the end of the order. Every creation is one undo step.

The New button in the Constraints panel opens the New constraint dialog. Choose the Physics type and enter the bone in the Target field; if the name is unknown, Ligamen takes the selected bone, or the last bone of the skeleton when nothing is selected. The other values are the Spine defaults and are edited in the panel.

The rows of the panel#

Select the constraint in the Constraints panel or in the Tree. The detail is also shown in Properties. Its header reads Phys · bone and the name of the bone. Bone is the simulated bone; click the chip to choose another one. Translate has two chips, X and Y, and below them are Rotate, Scale X and Shear X. These five are the channel shares in percent. A click asks the value: 100% means the full spring motion, 0% leaves the channel alone, and values above 100% exaggerate it.

Limit caps the speed of the simulated motion, 5000 by default, so that a very fast jump of the parent does not throw the bone away. FPS is the number of simulation steps per second, 60 by default. A higher value is smoother and slower to compute, a lower one is cheaper and rougher. The Skin row has the Skin required switch, described at the end. At the bottom are the Mix slider and the eye of the list row, which work as for IK (see IK constraints).

The spring values#

Six rows shape the spring. Each shows its number and has a Global toggle. Inertia decides how much of the motion of the parent the bone carries along: 1 follows it fully and lower values make it hang back. Strength is the stiffness of the spring that pulls the bone to its pose; a high value snaps back fast. Damping removes energy, so a value near 1 settles the motion quickly and a low one lets it swing for long. Mass makes the bone heavier and slower to start and to stop. Wind and Gravity are constant forces, 0 by default; set Gravity for hair that falls down and Wind for a breeze, and use a negative value for the opposite direction.

A good way to tune them is to drag the root bone in Setup and watch the live preview. Raise Damping if the bone never settles, raise Strength if it lags too much, and use Inertia for how lively it is overall.

Global values and Mix#

Every spring value, and Mix, can follow the global physics track instead of its own number. Turn on Global next to the value, or Global in the Mix global row, and the constraint reads that value from a track that is shared by all constraints. Key it once and the wind in the scene changes for every strand at the same time. The Dopesheet shows a row for each constraint and one more row, Physics (global), for the shared values (see Keys).

Keying physics#

In Animate, the number shown in a spring row is the value at the playhead. Typing a new number does not change the setup: it writes a key at the playhead, and the status line reports it. This is how a gust is made: key Wind to 0, then to a strong value, then back to 0. Strength can be keyed too, for example to stiffen a limp tail when a character wakes up.

The Keys row of the detail has two chips. Mix keys the shown mix at the playhead, which fades the whole constraint in and out. Reset keys a reset: the spring restarts from the pose at that time, which is useful after a cut or a teleport, so that the bone does not fly across the screen. The setup values stay untouched.

Warm Up, Physics and Reset in playback#

The Playback panel has a Physics row with On, Off and Reset. It appears only when the skeleton has a physics constraint. Off shows the plain animated pose, which is handy for checking the animation without the spring, and Reset restarts the springs. In Properties of an animation, the Warm Up value, from 0 to 60 seconds, runs the simulation for that long before the first frame, so a looped animation starts already settled and not from rest.

Physics constraints and skins#

A physics constraint can belong to a skin. Turn on Skin required in the Skin row and the constraint runs only while a skin that lists it, or default, is on. Add it to a skin with Skin Membership in the Tree (see Skins). The constraints are kept in .ligamen, in Spine JSON and in the 4.2 and 4.3 binary skeleton. Formats below Spine 4.2 have no physics, so the export bakes the motion into bone keys, with a warning. The demo scene docs/examples/physics/fox.ligamen shows a tail that lags behind a running fox, hair that settles under gravity and a key on the global Wind that blows both strands.