You can use the Configurable JointA physics component allowing a dynamic connection between Rigidbody components, usually allowing some degree of movement such as a hinge. More info
See in Glossary to constrain both the linear and rotational movement on each joint axis independently.
Use X, Y, Z Motion for linear movement, and X, Y, Z Rotation for rotational movement. By default, these axes correspond to the object’s local axes, defined by the Axis property. To constrain movements to the global axes instead of the object’s local axes, enable Configured In World Space.
You can set each axis to Locked, Limited or Free:
To limit linear movement, use the Linear Limit property, which defines the maximum distance the joint can move from its point of origin (measured along each axis separately).
To limit rotation, use the Angular Limit properties. You can specify different limit values for each axis with this property. You can also define separate upper and lower limits on the angle of rotation for the x-axis; the other two axes use the same angle either side of the original rotation.
You can simulate a bouncy surface at the joint’s limits. By default, a joint stops moving when it reaches its limit. However, a non-elastic collisionA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info
See in Glossary like this is rare in the real world, and it is often more realistic to add some bounce to a constrained joint.
To make the constrained object bounce back after it reaches its limit, use the Bounciness property of the linear and angular limits. Use a low number for a more realistic, natural collision, or set it higher to simulate unusually bouncy boundaries like the cushions of a pool table.
You can simulate a spring-like elastic behavior to the joint when it exceeds its limits. To do this, use the spring properties Linear Limit Spring for linear movement, and Angular X/YZ Limit Spring for rotation. When you set the Limit Spring property to a value above zero, the joint does not stop moving when it hits a limit; instead, it crosses the limit, and the spring force draws it back to the limit position. The Limit Spring value determines the strength of the force. By default, the spring pulls the joint in the opposite direction to the collision.
To reduce the elasticity and return the joint to the limit more gently, use the Damper property.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.