Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Obi Rope Pipe Water Flow Effect
#7
(27-01-2022, 02:19 PM)josemendez Wrote: You need to accumulate distance as you go, not just grab the distance between the current particle and the previous one. Otherwise the sine value will be basically the same for every particle, instead of varying along the rope.

Like this:

Code:
float distance = 0;

        for (int i = 0; i < rope.solverIndices.Length; ++i)
        {
            int solverIndex = rope.solverIndices[i];

            if (i > 0)
            {
                int previousIndex = rope.solverIndices[i - 1];
                distance += Vector3.Distance(rope.solver.positions[solverIndex],rope.solver.positions[previousIndex]);
            }

            rope.solver.principalRadii[solverIndex] = Vector3.one * (baseThickness + Mathf.Max(0, Mathf.Sin(distance * bulgeScale + time) * bulgeThickness));
        }

I threw a "bulgeScale" multiplier in there, so that you can control the width of the bulges.

Yep, this is working properly. But for those who will see this post later, I would like to point out you should increase particle count to get better results.
Reply


Messages In This Thread
Obi Rope Pipe Water Flow Effect - by NorkQ - 27-01-2022, 11:16 AM
RE: Obi Rope Pipe Water Flow Effect - by NorkQ - 27-01-2022, 01:40 PM
RE: Obi Rope Pipe Water Flow Effect - by NorkQ - 27-01-2022, 02:08 PM
RE: Obi Rope Pipe Water Flow Effect - by NorkQ - 27-01-2022, 04:57 PM