- Home /
Configurable Joint chain with no spring/stretch?
I have a very long chain set up with Configurable Joints, all parented to an empty GameObject. The top link has a kinematic Rigidbody. It kind of works, but it's very stretchy/springy. I'm trying to get it to hold together like an actual chain, so that it can bend and swing around without springing like elastic. I'd be willing to accept a tiny bit of spring/stretch, but with the way it is now there's no way it could possibly pass for a chain.
I've played around with the limit, spring, and bounciness settings for all the links, but the only way I can find to make the chain hold together like a chain, is to set all the Y Motions to "locked". The problem with this is that it prevents free movement, so the chain can't bend on a Y axis at all; the object hanging on the very bottom can't move around while the attached chain follows. It's kept at the same Y distance all the time.
Is there any way to achieve a realistic, free-swinging chain effect with an object on the bottom, if it's a very long chain? Do I need a different type of joint? I've been playing around with each one, but they all have problems. Hinge Joint and Character Joint chains just immediately start freaking out, likely due to the fact that my chain is 289 links long. Fixed Joints stretch before freaking out as well. Configurable Joints seem to be the only joint that can handle a chain of this length, but no matter how small I set the limits or how high I set the spring parameters, the chain still stretches considerably.
I've tried scripting limits for each link, but haven't been able to find a solution that doesn't cause the chain to keep twitching violently. I've played around with the Rigidbody masses, drags, and constraints, and the solver settings in the Physics Manager. I've modified every setting I can think of, but I'm stumped. If scripting is the only way to go about this, does anyone have any ideas for what might work?
Thanks.
(I'm using Unity 5.6.3f1.)
Answer by DenisIsDenis · Jun 20, 2021 at 09:29 AM
Perhaps you need this kind of setting of the CharacterJoint
parameters:
I had to freeze all the Rigidbody rotations to stop my chain from freaking out, but unfortunately even with this it's still stretchy. I can stop excessive stretching by setting the Rigidbody drag to 1 as shown here, but the chain doesn't really swing then. Thank you, anyway.
Answer by amcfarlandhome · Oct 18, 2021 at 04:44 AM
@SirBedlam Hey, I am currently doing something similar with a character joint. I'm not sure exactly how different the mechanics are between character joints and configurable joints, but I have somewhat of a solution with a caveat.
.
If you enable projection on the joints this prevents any sort of stretching/flying around nonsense that Unity joints like to engage in. I'm sure the scale/size of your chain links might require you to do a little tweaking, but my settings are: Projection enabled, Projection Distance set to 0.01, and Projection Angle set to 180.
.
The caveat however, is that while the chain physics look nice and realistic at low speeds, you lose the ability to properly build momentum in any swinging like motions. So depending on what you need the chain physics for, it will not work for those kind of high speed things.
.
Also, I don't know if you are still working on this or have completed the project, but would you at all be willing to share images of your joint settings? I'm thinking that maybe if I switch to a configurable joint instead of a character joint and allow some linear flexibility it might help fix my momentum problem, but I'm having difficulties converting my character joint settings to configurable joints. If you'd be willing to share it would be very helpful.
Your answer
Follow this Question
Related Questions
Configurable Joint just falls apart? 1 Answer
How target rotation and target angular velocity work in configurable joint ? 1 Answer
How do I select a joint component from a GameObject that has multiple joint components? 1 Answer
If a joint has a Connected Body, does it ignore the Anchor position? 1 Answer