Constraint System Manual

Get Started

There're some operations that all constraints share, we would explain in this page together.

◊ ConstraintStack 

ConstraintStack is the main hub when access constraints on GameObject. When work with constraints, the first thing to do is to add ConstraintStack on GameObjects.

ConstraintStack is a standard MonoBehaviour, so you could add it like any other Behaviours.

ConstraintStack1 

The image above is a constraint stack with three constraints. As you can see, the editor mainly contains three sections:

The first section is the list of constraints. There're five items per line:

  • The constraint button, clicking this will bring up the editor panel for that constraint, also this button's background indicates the "active" and "influence" state;
  • The active button, clicking this button will toggle the active state for the constraint;
  • The move-up button, clicking this button will bring the constraint up one slot in the stack;
  • The move-down button, clicking this button will push the constraint down one slot in the stack;
  • The delete button, clicking this button will remove the constraint from stack and destroy it from owner GameObject;

The second section is the "Exec Order" used to decide the execution order among multiple ConstraintStacks. Like the Unity's script execution order setting, the lower the "ExecOrder", the earlier it gets evaluated.

The third section is the "Add Constraint" button, it will bring up the list of available constraints when you click the button. Clicking anyone in the list will automatically add the constraint into current ConstraintStack.

ConstraintStack2 


◊ Common settings of constraints

Each constraint has its own unique functionality, and unique settings.

But they do share some common settings, let's examine them here.

ConstraintStack3

The image above shows the editor for a constraint. Although there're many options inside, we only focus on those are shared by most constraints.

The first line has the "active" & "gizmos" toggles, Although all of the constraints has "Active" property, only about half of the constraints has gizmos;

The second line is the "target" field, except the LimitPostioin/Rotation/Scale, all of the constraints need a target to work;

The last line is the "influence" bar, which is shared by all of the constraints. It controls how much influence this constraint has on the owner GameObject;

 

In the next pages, we will explain each constraint with the corresponding examples scenes.