Skip to main content

Position Constraints

Position Constraints are Unity built-in Components that will copy the world-space position of a single target, or blend between multiple positions when given multiple targets. They are a primary tool to manipulate Transforms, hence why I will briefly explain them here. Constraints generally have the following properties:


Is Active - This will simply activate/deactivate the constraint.

Weight - This is the overall weight of the constraint. This is a normalized value between 0 and 1 and will blend linearly between the "Position at Rest" and the final result of the constraint position.

Constraint Settings:


Lock - When locked, neither the "Position at Rest" nor the "Position Offset" will change. You generally want this to be locked, and Unity will automatically lock it in playmode.


Position at Rest - This is the position where the object rests aka when its not effected by the contraint. Generally this should be at (0,0,0)

Position Offset - Is generally calculated from the "Position at Rest" and the constraint position. You generally dont need to adjust this. Generally this should also be at (0,0,0)

Freeze Position Axes - Terribly named, simply determines which axes are effected by the constraint.

Sources - This is the list that will contain all of the target transforms and their associated weight. Important to note here is that the weights will be normalized, when there is more than one target.

Be aware that Constraints are active even when the Editor is in "Edit Mode". More importantly, changes made to a transform by a constraint, wont be recorded by the Undo system. This means that you can permanently break things, when messing with constraints rather easily.

 

This is how a standard PositionConstraint configuration looks like:

image-1652206119607.png

For more information on (Position) Constraints look in the Unity Manual:
https://docs.unity3d.com/Manual/class-PositionConstraint.html