Kangaroo object are solved but appear to be moving because of one vector

I have an assembly of random object that are grouped by some springs and rigid bodies and a custom goal for lines keeping them parallel. Without my goal the simulations solves in around 700 iterations but when I use it it solves also fast but then starts floating in space. I think its because it could not converge for some of the vectors I used in my goal:

So my question is how do I compensate for this behaviour? Because it solves for all lines in the end do I have to set some kind of threshold that would deem the solution as successful? I tried with a simple counter but doesn’t seem to be reasonable.

      b1 = b2 = b3 = true;
      var angle = Math.Abs(Lim) * Math.PI / 180;

      //var c1 = Vector3d.CrossProduct(mVV1, mV1);
      var a1 = Vector3d.VectorAngle(mVV1, mV1);
      if (Math.Abs(a1) > angle )
      {
        Move[6] = m12 - m2;
        Weighting[6] = Strength;
      }
      else
      {
        Move[6] = Vector3d.Zero;
        Weighting[6] = 0.0;
        b1 = false;
      }

      var a2 = Vector3d.VectorAngle(mVV2, mV2);
      if (Math.Abs(a2)  > angle)
      {
        Move[8] = m32 - m4;
        Weighting[8] = Strength;
      }
      else
      {
        Move[8] = Vector3d.Zero;
        Weighting[8] = 0.0;
        b2 = false;
      }

      var a3 = Vector3d.VectorAngle(mVV3, mV3);
      if (Math.Abs(a3) > angle)
      {
        Move[10] = m52 - m6;
        Weighting[10] = Strength;
      }
      else
      {
        Move[10] = Vector3d.Zero;
        Weighting[10] = 0.0;
        b3 = false;
      }

      if (b1 == false && (b2 == false & b3 == false))
            if (b1 == _b1 && (b2 == _b2 && b3 == _b3))
              counter++;

      //      if (counter > 20)
      //      {
      //        Move[10] = Move[8] = Move[6] = Vector3d.Zero;
      //        Weighting[10] = Weighting[8] = Weighting[6] = 0.0;
      //      }

      _b1 = b1;
      _b2 = b2;
      _b3 = b3;

Hi @ankere
I can’t figure out what’s happening here from this bit of code.
If you want to post the definition (or send it to me if you don’t want to post it here) I’ll take a look.
Also - if what is needed is to keep pairs of lines parallel, you can use the Angle component with an angle of 0. (the segments do not need to share a point)

1 Like

Hello @DanielPiker

I would prefer to use a PM if you are OK with it? I will send a message with two of my papers that are not open access yet as it can clarify things up. I will attach a definition as well. Message title is “Triangle definition question”.

The angle goal did not work for me or at least I could not make it work because one of the lines must be defined and change during the steps of the solution.