Example #1
0
 void Joints(ClothMass2D clothMass2D, int baseX, int baseY)
 {
     clothMass2D.ConnectMass(GetMass(-1 + baseX, 0 + baseY));
     clothMass2D.ConnectMass(GetMass(0 + baseX, 1 + baseY));
     clothMass2D.ConnectMass(GetMass(1 + baseX, 0 + baseY));
     clothMass2D.ConnectMass(GetMass(0 + baseX, -1 + baseY));
 }
 public void ConnectMass(ClothMass2D clothMass2D)
 {
     if (clothMass2D != null)
     {
         //var joint = CreateRelativeJoint2D();
         var joint = CreateSpringJoint2D();
         joint.connectedBody = clothMass2D.GetComponent <Rigidbody2D>();
     }
 }
Example #3
0
    void Joints1(ClothMass2D clothMass2D, int baseX, int baseY)
    {
        for (var x = -1; x < 2; x++)
        {
            for (int y = -1; y < 2; y++)
            {
                if (x == 0 && y == 0)
                {
                    continue;
                }

                clothMass2D.ConnectMass(GetMass(x + baseX, y + baseY));
            }
        }
    }
 void JointStrategy(ClothMass2D clothMass2D, RelativeJoint2D joint)
 {
     joint.linearOffset = clothMass2D.transform.localPosition - transform.localPosition;
 }