- Home /
2D Chain Issues
Hello there. Quite a simple mechanic that I cant seem to implement. Im trying to use a chain of 2d sprites (connected by hinge joints or other) and having this connected between a carriage and train. Then when I add force to the train via velocity I can "pull" the carriage behind me via the chain. However every attempt ive had has resulted in half the chain disconnecting and nothing being pulled.
Any ideas?
Answer by MelvMay · Sep 26, 2016 at 07:38 AM
Use a DistanceJoint2D with MaxDistanceOnly set to true. Connect this between the first body and the last and set the distance appropriately (or use auto-calculate distance) to ensure that the force doesn't stretch the joints.
Hi $$anonymous$$elv$$anonymous$$ay thanks for the reply. I used your suggestion in my project $$anonymous$$us the chains to make it a bit simpler. As you can see im now pulling the other train nicely but after speeding up the distance between the joint increases. https://i.gyazo.com/f71049e0a785d1d80293e9e6f944b899.mp4 Any suggestions as to what I can do to stop this from happening? Thanks.
Your answer
![](https://koobas.hobune.stream/wayback/20220612093503im_/https://answers.unity.com/themes/thub/images/avi.jpg)