Distance
Info
This article covers the behavior and properties of this particular constraint. For instructions on how to add constraints to your project and connect them to physics objects, see the Physics Constraints Overview article.
Behavior
The Distance Constraint is like a stiff rod or rope connecting two objects, keeping them a fixed distance apart—but still letting them move and rotate independently.
As you can see, the objects maintain a fixed distance from one another but are otherwise able to rotate and slide on their own. It is like a more forgiving version of the Fixed Constraint.
Properties
The Distance Constraint implements the following four properties:
- max limit
- spring
- damping
Max Limit
The first property is max-limit, which defines the maximum distance the connected object can travel from the center of the constraint. You can see this property visualized by the white-ish T indicator that moves as you adjust that value.
If we run the simulation you will see the ball fall toward that max length value OR be drawn up to it, if the simulation starts with the ball out of range.
Spring
Spring controls two aspects of this constraint's behavior.
First: Increasing the spring value will determine how "bouncy" the object is when hitting the limit of the constraint. For example, if we set spring to 5,000, you will see more rebound at the end of the constraint than in the example above (where it is set to zero)
Instead of simply coming to a rest immediately at the bottom of the constraint, you can see it has some give and bounce. Obviously, the incoming velocity and properties of the connected object also have a hand in this calculation.
Second: The higher the spring value, the faster it will return the object to within the max limit should the object be moved beyond it, which can happen if another object applies a significant force to it or if the object itself begins the simulation outside the range as shown here:
Damping
Damping is like friction for the constraint's frequency. The higher the damping, the more force required to move the object along the constraint.
Success
Learn about the next type of constraint, Hinge Constraints.