# 2d Rope

This topic is 5151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Just to start off I'd like to state that I have no experence in physics, but I need to learn how to make a 2d rope simulation. Ive been trying it all day long, with 20 particles, I tried useing springs, but I belive my inmplmentation was incorrect, because the spring system didn't work, and the rope became infinitly long, and soon after the system crashed. so I've decided to ask for some help, and start from scratch, perticuarlly im not even sure I was doing the particles in the rope correcly, In fact I could vouch it was wrong in some why, so thats my first question, 1. could I have an explination of how Gravity, Position, Velocity and the TimeStep size interact. in the past I used something like this: Vel=Vel+Acc(gravity usually); Pos=Pos+Vel*Time; but those were simple visual particle effects and it worked fine for my requirements. 2. givin that my rope is made of seperate particles I am suppost to keep them together with a springs correct? I found the formula F=-K*(Distance-OptimalDistance) I just added this into my velocity originally, but the spring didn't seem to have enought effect to keep the particles close and the system exploded. thanks in advance for any help.

##### Share on other sites
I once wrote simulator that simulates big rope with really many particles. It's written in pascal but should be readable for c++ programmers.

##### Share on other sites
for every particle
vForce = 0
for every neighbour
vForce += fK * ( fDistToNeighbour - fRestDistToNeighbour ) * vDirToNeighbour
end for every neighbour
vAcc = vForce / fMass
vVel += vAcc * fDt
vPos += vVel * fDt
end for every particle

Force between neighbours is the same but opposite if the neighbours are connected with springs so there's room for optimization here.

JD

##### Share on other sites
Many thanks for both of your help, I have it working decently,

the springyness of the rope is slightly bugging me, but its not unreasonable. I did have some rather nasty problems where the program crashed from Floating Point Underflows, but I belive I have corrected it.

thanks again.

##### Share on other sites
to have a much more rigid rope (no spring), you can use Jackobsen's technique.

http://www.ioi.dk/Homepages/thomasj/publications/gdc2001.htm

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5
JoeJ
13

• 9
• 14
• 10
• 25
• 9
• ### Forum Statistics

• Total Topics
632645
• Total Posts
3007626
• ### Who's Online (See full list)

There are no registered users currently online

×