Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Part of rope Tense
#2
(17-03-2021, 03:55 PM)tpaslou Wrote: With regard to this post http://obi.virtualmethodstudio.com/forum...d-490.html , I would like to know if it is possible to test if a specific part of the rope is tense , for example the part between 2 control points

Hi there,

It's possible, but you will have to implement it yourself.

The idea is exactly the same as checking tension for the entire rope: you calculate the current length and the rest length between two points in the rope, and their quotient tells you the strain.

To calculate the current length between two points, you can take ObiRopeBase's CalculateLength() method as reference:

Code:
public float CalculateLength()
        {
            float length = 0;

            if (isLoaded)
            {
                // Iterate trough all distance constraints in order:
                int elementCount = elements.Count;
                for (int i = 0; i < elementCount; ++i)
                    length += Vector4.Distance(solver.positions[elements[i].particle1],
                                               solver.positions[elements[i].particle2]);
            }
            return length;
}

Only instead of iterating trough all elements from 0 to elementCount (the entire rope), you iterate between any two elements you like.

Same for the rest length, the base implementation does:

Code:
public void RecalculateRestLength()
{
            restLength_ = 0;

            // Iterate trough all distance elements and accumulate their rest lengths.
            int elementCount = elements.Count;
            for (int i = 0; i < elementCount; ++i)
                restLength_ += elements[i].restLength;
}

Again, you just change the iteration range.

When you have both lengths, just divide them to get the strain.
Reply


Messages In This Thread
Part of rope Tense - by tpaslou - 17-03-2021, 03:55 PM
RE: Part of rope Tense - by josemendez - 18-03-2021, 09:36 AM
RE: Part of rope Tense - by tpaslou - 18-03-2021, 12:47 PM
RE: Part of rope Tense - by josemendez - 18-03-2021, 01:39 PM
RE: Part of rope Tense - by tpaslou - 18-03-2021, 02:29 PM
RE: Part of rope Tense - by josemendez - 18-03-2021, 02:34 PM
RE: Part of rope Tense - by tpaslou - 18-03-2021, 02:59 PM
RE: Part of rope Tense - by josemendez - 18-03-2021, 03:09 PM