Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  A few technical questions
#1
Hi, great asset btw. 

Is there a way to programmatically calculate the points of the rope? I wish for the rope to curl around a cylindrical object much like a firehose. 
And is there a way to programmatically force the rope to be a fixed length during set up?

Thank you so much.
Reply
#2
Hi, bumping up; still need the help!
Reply
#3
This code gets that available points inside the rope


Code:
       //ObiRope rope = obiRopeObj.GetComponent<ObiRope>();
       //ObiPinConstraintBatch pinConstraints = rope.PinConstraints.GetFirstBatch();
       //pinConstraints.AddConstraint(0, startConnectedObj.GetComponent<ObiCollider>(), startConnectedObj.transform.localPosition, Quaternion.identity, 0);
       //pinConstraints.AddConstraint(rope.UsedParticles - 1, endConnectedObj.GetComponent<ObiColliderBase>(),
       //                                                  endConnectedObj.transform.InverseTransformPoint(endConnectedObj.transform.position), Quaternion.identity, 0);


All theory here:
You could potentially loop through the batch of pinConstraints (rope.UsedParticles -1 is max size) and lock pins in to place by feeding them a Vector3 location. If you want it spaced evenly then you could take the distance and divide it by the usedparticles - 1. That would space it out equally. If you want, use a lerp function in a coroutine to find your desired points in space at run time. As you lerp to each new point, pin the particle at that location.
Reply