Skip to content

Slider

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 slider constraint allows two bodies to move along a single axis while blocking rotation. It's basically a physics-based linear slide joint, similar to a suspended roller coaster.

roller coaster example for unbound docs

This is probably the most complicated of unbound's constraints, but by the end of this article you should be all set 😄

slider UI in unbound

To stick with the roller coaster analogy, the white bar would be like the track. This represents the length and direction (vector) along which the rig will slide.

The pink rig is what connects the object to the track. One segment will always remain perpendicular to the track and the other two will grow and shrink as needed in order to keep a rigid connection all the way to the connected object.

demonstrating of how the slider rig in unbound moves to accommodate the connect object's location

Assuming the bar is pointed in the direction of gravity and the properties (see below) are in agreement, connected objects will slide down the bar.

demonstration of slider constraint in unbound

Tip

As with all other constraints, if there is only one connected object, the entire rig will behave as if connected to a platform (it will not fall with gravity), as is the case if one of the connected objects actually is a platform. If both connected objects are dynamic, the entire rig will fall in accordance with gravity.

Properties

The Slider Constraint implements the following four properties:

  • max limit
  • friction
  • Spring
  • damping

Max Limit

Max limit determines the length of the bar along which the rig will travel.

bar of distance constraint in unbound

Friction

Friction affects how easily objects slide along the bar.

Spring

Spring acts like bounciness or easing. The higher the spring value, the softer the object lands and rebounds from the max limit. Here is an example of a slider with the spring set to 1 (the max value). It's almost like controlling how tight or loose the suspension is on the system.

spring demonstration of slider constraint in unbound

Damping

Damping controls how tight (1) or loose (0) the action of the spring is. It's like applying friction directly to the spring value. Here's the same simulation as above but with the damping turned all the way up.

damping demonstration of slider constraint in unbound

As you can see the rig does not pass as far beyond the limits of the bar. It also comes to a stop much more quickly than in the example above.

Note

Friction affects the slider as a whole, while damping affects only the spring.