- Home /
Minimum distance on configurable joint?
Is it possible to set a configurable joint to have a "minimum distance". For example to set the two connected objects not to be able to move within 10 units of one another. Obviously you can set a maximum distance (the linear limit) but I cannot find a minimum distance. If it doesn't exist then can anyone think of a way that I can implement it?
Thanks in advance!
Why rotation tag? are you trying to rotate or move the joint?
Answer by Jean-Fabre · Feb 01, 2011 at 07:16 AM
Hi,
If you actually move the joint anchor point say 20 unit in x, and set the linear limit to 10, then you end up with a joint that will prevent the two connected objects to be closer than 10 units, but you are then also limited on the maximum distance between the two, which will be in that case 30.
The solution ( untested ) would be to adjust the linear limit value in real time as the joint is evolving if you actually want to have unlimited or uneven maximum/minimum.
Also, could you describe why you are actually willing to do this, their might be other way around this problem. Are you trying to do technical rigs, or something like that?
One quick solution that I would test as well is to put hard limits using colliders, this might be sufficient for your problem. But be careful, the two connected bodies collider are not able to interact with each other ( very unfortunate, at least they could offer a toggle to enable it...), you'll have to build another collider parented to one of the connected body.
If you are stuck, I can provide a small example if that would help you progress.
Bye,
Jean
I am employing physics similar to "world of goo" (connections between balls) and I need it so that once connected two balls cannot go within a certain distance of one another, if it's easier then they could permanently be a fixed distance away from eachother. Each of them moves fairly often. Unfortunately due to a gameplay mechanic I can't simply put colliders in (although that is a fantastic idea). I tried to implement your idea about a linear limit and anchor but I unfortunately could not get it working. Thanks for your help though. $$anonymous$$uch appreciated!
Are you aware the layer collision matrix in the physics settings? this is potential the missing link for your case, create a set of colliders that only interact with each other to achieve your desired result.
Answer by BrainFooLong · Dec 28, 2015 at 01:49 PM
The question is old i know, but google leads to this site everytime you search a solution for this issue :) In my case i solved this by adding 2 same joints vice-versa. One time from objA to objB and than from objB to objA, with a linearLimit distance.
So the objects are in a fixed distance between each other.
May not work for everyone, depends on the complexity of the joints.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
configurable joints reset the limit 0 Answers
Limiting physics between two objects 0 Answers
Rigidbody unaffected by standard unity gravity and script gravity 3 Answers