How to calculate Tension for a series of connected points?

  • Thread starter Thread starter Tyson1992
  • Start date Start date
AI Thread Summary
To simulate a rope in a game, a series of connected points must apply tension to maintain their distance apart while accounting for movement and angles. The challenge lies in calculating the appropriate force for each pair of points, especially when they exceed their maximum distance, which affects the entire chain. Current methods involve checking distances and velocities each frame, but this can slow down performance. A suggested approach is to model the rope as a series of massive nodes connected by massless springs, allowing for realistic tension calculations. Understanding how angles and forces interact in a multi-point system is crucial for accurate simulation.
Tyson1992
Messages
4
Reaction score
1
TL;DR Summary
Programming a rope for a game, need to apply tension force to pairs of points to keep them together and acting like a rope, figured out how to calculate a 4 point chain (3 "rope" pairs) but having trouble past that.
In an effort to simulate a rope for a game I'm making, I'm programming a series of points that, when a connected pair moves away from each other past their max distance, applies an equal force to both points towards each other to stay within max distance by cancelling out their relative motion away from each other.

When taut this would pull connected pairs past their max distance so I need to apply the appropriate force there as well all the way down the taut connections which increases the force for the preceding pairs.

I've figured out a formula to calculate a 4 point chain (3 "rope" connections) accounting for varying angles and masses, but am having trouble past that.

I can brute force it by writing out 2 different starting values and using how much it changed between them to calculate the correct answer but that would severely slow down the program.

I wasn't sure where to put this, what prefix to use, and don't know what to look up to find it cause I'm a hobbyist and first time poster. None of the tension examples I find have the ropes connected in series, just a static object to non-static object pairing, and the one time I found a series it was just a straight line.

Any help would be appreciated.
 
Technology news on Phys.org
Welcome to PF.

There are many approximations possible. They can be in 2D or 3D, and you can make it as accurate as you require.

I would model the rope as a discrete chain of points. Each point would have the same lumped mass, a position in 3D and a velocity in 3D. The rope would also have a total length when not under tension. For each time-step, evaluate the total length, compute the excess length, and from that the tension along the entire rope.

Then, for each time-step, evaluate the next position of each discrete point in the rope. For each point, calculate how it will be pulled by its two nearest points, the force acting to accelerate the point mass, update the velocity and its next position.
 
If I compute tension from excess length the rope will be stretchy, which I don't want, and in order to keep the individual pairs within a max distance they need individual tension values, otherwise a bunch of points can be on top of each other with one way off in the distance.

This is why, currently, every frame each pair is checked for max distance, then for velocity away from each other. For each pair that's taut and moving away from each other, I apply force towards each other, but I need to also apply tension to taut pairs down the chain so fixing one pair doesn't create the same problem elsewhere.
 
Tyson1992 said:
This is why, currently, every frame each pair is checked for max distance, then for velocity away from each other.
But that does not work.

Being elastic does not make a rope into a bungee cord. A tension supporting 1000 kg might only lengthen the rope by 1%.

The rope will move as a result of the ends being controlled in some way. Each segment of the rope will have a mass and a velocity that will control its trajectory.

If there is any tension in the rope, points along the rope should move to straighten the rope. That will pull in at sharp corners to make a more rounded loop. If there is no tension in the rope, the rope will keep moving, or lie there until it is pulled by the end of the rope.
 
1. Would you care to expand on "that does not work"

2. If I compute tension based on excess length, the tension(force) will increase with length over it's resting length, rather than applying force appropriate to preventing further stretch.

3. I'm not having any problems making a chain of points look like a rope, I'm trying to calculate the appropriate amount of force to apply to counter the points relative motion away from each other, so that when the rope is connected to objects it will pull on the object (and the object will pull on the rope) realistically.

4. I posted this in Calculus to get help with the math, it was moved here afterwards.
 
Tyson1992 said:
1. Would you care to expand on "that does not work"

As you said yourself

Tyson1992 said:
[...I] am having trouble past that.

You are having trouble because you are not using an appropriate model. Let's start again.

Tyson1992 said:
TL;DR Summary: Programming a rope for a game, need to apply tension force to pairs of points to keep them together and acting like a rope,

To model a rope, use a series of massive nodes connected with massless springs (that only have force when extended, not when compressed).

Tyson1992 said:
If I compute tension from excess length the rope will be stretchy, which I don't want

But ropes ARE stretchy. If they didn't stretch they would be rigid bodies and rotate about their centre when you disturbed an end. You can make the modulus of the springs as high as you want to make the amount of stretch invisible to the user, but if you make it [Edit] infinite zero you can't do any discrete steps with it because ## \delta v = \dfrac k 0 \delta t = \infty ##.

Tyson1992 said:
4. I posted this in Calculus to get help with the math, it was moved here afterwards.

The calculus forum is for help with analytic solutions to continuous functions. This is the right forum for discrete time step modelling.
 
Last edited:
  • Like
Likes berkeman and Baluncore
Maybe this will clear things up.

TL;DR Summary: A straight series of points is effectively one point of all their mass combined, but how do angles in the chain of points change the tension?

When a series of points are connected in a line and acceleration is applied to one end, the tension can be calculated with just the masses.

For the example in the picture, I can calculate the tension by taking the relative acceleration between the moving point and the one it's connected to, and dividing by the total mass divided by the mass of one side of the acceleration and then divided by the mass of the other.
The result is .8 which when calculated out, shows every point moving moving .2 in the direction of acceleration. 1 m/s of a 1kg object is 1 newton of force, split between 5kg is .2 m/s, so that's correct.

In the other picture with 2 bends, how would one get 0.5365853654 for the starting tension?
I've put together a formula for a four point chain by essentially trial and error, but I don't really understand on a practical level how the angles are affecting it.

If there's an explanation for this in a textbook or website that someone knows about that'd be good too.

20250627_172129.webp


20250627_172140.webp
 
Last edited by a moderator:
Your 'trial' model is too simple - you are only considering the situation where force is applied parallel to the direction of the last 'link'. A rope model needs to cope with a more difficult situation: an initially straight rope where force is applied orthogonally.

Tyson1992 said:
If there's an explanation for this in a textbook or website that someone knows about that'd be good too.

I have already given you one link (pun intended), if you don't like that one search the interweb for "game physics rope".
 

Similar threads

Back
Top