Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'Free-Fall' mode for Rope
#2
(02-10-2017, 05:52 PM)basilfamer Wrote: Is there any way to set a rope to not stretch at all and to extend more rope whenever it's pulled? A mode where there is never any strain or tension, and the rope is in a free-fall state, where even gravity will pull on the rope. It's also important to be able to turn this mode off without a sudden spring-back behavior in the rope.

- I've tried using a temporary Obi Handle for the end of the rope, and set the rope's length to the distance between the rope's start & end before disabling the handle; but this didn't help with the spring-back problem.

- I've also tried increasing the rope's length any time the strain (calculated using Rope.CalculateLength() / Rope.RestLength) passes 1. This however was not stable or precise, which made it unfavorable.

This is currently the one thing stopping me from being able to use Obi in my product & it would make my day if I could find a solution for this.

You're going to need to use the ObiRopeCursor with your rope. You can see an example in the Crane scene. To see if the rope being stretched to start expanding your rope you can do something like this:


Code:
public bool IsStretchingRopeGreaterThanResistance(float resistanceMultiplier)

        {
            ObiDistanceConstraintBatch distanceBatch = Rope.DistanceConstraints.GetBatches()[0] as ObiDistanceConstraintBatch;
            float[] forces = new float[distanceBatch.ConstraintCount];
            Oni.GetBatchConstraintForces(distanceBatch.OniBatch, forces, distanceBatch.ConstraintCount, 0);

            for (int i = 0; i < forces.Length; i++)
            {
                float p1Resistance = Rope.tearResistance[distanceBatch.springIndices[i * 2]];
                float p2Resistance = Rope.tearResistance[distanceBatch.springIndices[i * 2 + 1]];

                // average particle resistances:
                float resistance = (p1Resistance + p2Resistance) * 0.5f * resistanceMultiplier;

                float force = -forces[i] * 1000;

                if (force > resistance)
                {
                    return true;
                }
            }

            return false;
        }
Reply


Messages In This Thread
'Free-Fall' mode for Rope - by basilfamer - 02-10-2017, 05:52 PM
RE: 'Free-Fall' mode for Rope - by niZmo - 02-10-2017, 09:50 PM
RE: 'Free-Fall' mode for Rope - by basilfamer - 02-10-2017, 11:33 PM
RE: 'Free-Fall' mode for Rope - by josemendez - 03-10-2017, 09:32 AM