Legacy Documentation: Version 4.5
Previous
Hinge Joint 2D
Next
Wheel Joint 2D

Slider Joint 2D

Switch to Scripting

The Slider Joint 2D component allows a Sprite object controlled by rigidbody physics to slide along a line in space. The object can optionally be left free to move anywhere along the line in response to collisions or forces. It can also be moved along by a motor force and have limits applied to keep its position within a certain section of the line.

Property: Function:
Collide Connected Can the two connected objects collide with each other?
Connected Rigidbody The other Rigidbody2D object that the one with the joint is connected to. If this is null then the othen end of the joint will be fixed at a point in space.
Anchor Coordinate in local space where the end point of the joint is attached.
Connected Anchor Coordinate in the other object’s local space where its end of the joint is attached.
Angle The angle of the line relative to the other rigidbody (or world space).
Use Motor Should the sliding motor be enabled?
Motor Speed Target motor speed (units/sec).
Maximum Motor Force The maximum force the motor can apply while attempting to reach the target speed.
Lower Translation The minimum distance the rigidbody object can be from the connected anchor point.
Upper Translation The maximum distance the rigidbody object can be from the connected anchor point.

Details

The Slider Joint can be used for sliding objects such as doors but also for any objects that follow a simple, straight path. Such objects might include simple characters, obstacles that rise or fall from their surroundings, projectiles and many other common game elements.

Previous
Hinge Joint 2D
Next
Wheel Joint 2D