Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inner strain at specific position
#2
(26-03-2020, 04:31 PM)fiasko Wrote: Hey there, 

I'm trying to measure the strain (or force.. or anything equivalent) at a specific point of the rope. Is that possible? Alternatively, the force/strain on a ParticleAttachment would also suffice.

Please note that comparing ObiRope.restLength and ObiRope.CalculateLength() is not working for me because it would also report some strain if one side of the rope hangs down freely (so it's stretched there) whereas the rest of the rope might be flat on the ground and I'm interested in the strain there.

To give some reference what I'm trying to achieve:
The player should be able to drag a "roll" (it's actually a rope of increasing length) of cable, that is attached to a plug one side towards another location and connect it there. I would like to measure the force at the roll to increase the length of the cable there as he walks.

Thanks in advance!

You could use rope elements to measure strain at any point. Elements are a wrapper over distance constraints, basically a struct that holds the following data:

- Solver indices of the two particles held together by the element.
- rest length of the element.
- current constraint force (only set for tearable ropes)
- tear resistance

The rope.elements array contains all elements in the same order as they appear in the rope (so elements[0] is at one end of the rope, and elements[elements.Length-1] is at the opposite end). So you could do (written off the top of my head, untested):

Code:
foreach (var element in rope.elements)
{
float actualLength = Vector4.Distance(rope.Solver.positions[element.particle1],rope.Solver.positions[element.particle2]);
float strain = actualLength / element.restLength;
}
Reply


Messages In This Thread
Inner strain at specific position - by fiasko - 26-03-2020, 04:31 PM
RE: Inner strain at specific position - by josemendez - 26-03-2020, 04:38 PM
RE: Inner strain at specific position - by fiasko - 26-03-2020, 05:00 PM