## Rope: Stretchable and non-stretchable

Discuss any questions about BEPUphysics or problems encountered.
mcmonkey
Posts: 92
Joined: Fri Apr 17, 2015 11:42 pm

### Rope: Stretchable and non-stretchable

For some insane reason, I have decided it would be useful to simulate a rope.

A rope reasonably can wrap around objects and extend to a known-at-construction-time base length.

Two forms of rope exist in my conceptualize of how rope works: Stretchable and non-stretchable.

Non-stretchable is theoretically the simpler form, it would simple behave like a rope - wrapping around things or just lying flat or hanging. It should be able to carry weight (within reason).

Stretchable rope is a bit more complex, it does all that but stretches based on how much force is pulling it apart, and it makes an attempt with a bit of force to bring it back to the base length any chance it gets.
It would scale in a sane manner: no force pulling = base length, some force = some stretching, much force = more stretching, but not as much relative stretching. What I mean is, if you move from 10 units of force to 100 units of force, it would maybe double in stretched length, and NOT stretch ten times longer. Probably a log scale or similar here.

I imagine the basic set up is a long chain of small static physical objects - cylinders perhaps, or thin boxes. connected by joints. However, this wouldn't stretch well without some applied cleverness, and I'm also not sure which joints within BEPU would best manage either type of rope.

So the question is: How would you set up each type of rope? If there are multiple ways to try it, what are the advantages and disadvantages of each method?

In an ideal "best situation", one should be able to stretch a rope around a cylindrical pole, and then release it, and watch it whip around rapidly at first then slowing as it unwraps the pole to shorten it's stretch length.

Norbo
Posts: 4815
Joined: Tue Jul 04, 2006 4:45 am

### Re: Rope: Stretchable and non-stretchable

The good news:
All constraints in BEPUphysics are, in fact, springs that happen to be very rigid by default. So it's actually not a question of stretchy versus not stretchy, but rather just how stretchy. Adjusting the stiffness and damping constants within the SpringSettings of constraints can support the desired behaviors. A bunch of demos use this functionality; check out the SelfCollidingClothDemo and the SuspensionCarDemo for a couple of examples.

So, a bunch of entities connected by BallSocketJoints would do the trick. You'll probably want to disable collisions between directly connected entities and make sure that the joint anchors are touching or within the volume of their involved entities to avoid long lever arms.