20-10-2021, 09:53 AM
(This post was last modified: 20-10-2021, 10:03 AM by josemendez.)
(20-10-2021, 09:23 AM)Matbee Wrote: can i somehow limit the length of the rope?
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).
(20-10-2021, 09:23 AM)Matbee Wrote: since other objects are associated with this actor, and it is necessary that the order is observed in order to animate the desired objects after working with a certain rope
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.