20-10-2021, 02:12 PM
(20-10-2021, 09:53 AM)josemendez Wrote: Don't really understand this question... ropes already have a limited length, their rest length. They won't exceed this length (that is, unless you attach their ends to transforms using static attachments, in that case you would be forcing them to stretch).Thank you, I solved the issue with the order of the ropes. I would like to know if it is possible to make the rope not stretch further after reaching its maximum length. So that I could pull it, for example, only 2 meters (conditionally) and could not go further
Still don't understand....why not using the order in which they appear in the hierarchy? the "solver.actors" array in the solver contains *exactly* the same data as Unity's transform hierarchy, but in a random order as it's basically a set: order does not matter. Unity will give them to you ordered, which is what you need right? why access them trough the actors array?
As I mentioned before, transform.GetChild() will give them to you in the order they appear in the scene hierarchy. So if you only have ropes inside the solver, you can access them ordered like this:
Code:var rope1 = solver.transform.GetChild(0).GetComponent<ObiRope>(); // first rope
var rope2 = solver.transform.GetChild(1).GetComponent<ObiRope>(); // second rope
var rope3 = solver.transform.GetChild(2).GetComponent<ObiRope>(); // third rope
If you have other objects mixed in, simply check whether or not they have a rope component.