Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tearing cloth via code (Finding constraintIndex)
#1
Hey so I'm trying to tear a ribbon in half at a specific point. I've been doing as described on this page http://obi.virtualmethodstudio.com/tutor...aints.html but I'm haivng a hard time figuring out where to tear. How do I figure out what the constraintindex of a specific point is? So far I've managed to guess my way to two out of three tear spots, but I've been guessing for a while now with no luck figuring out the last one...

Code:
public void CutAtPoints()
   {
       cloth.DistanceConstraints.RemoveFromSolver(null);
       cloth.BendingConstraints.RemoveFromSolver(null);
       for (int i = 0; i < constraintsToCut.Count; i++)
       {
           cloth.Tear(constraintsToCut[i]);
       }
       cloth.BendingConstraints.AddToSolver(cloth);
       cloth.DistanceConstraints.AddToSolver(cloth);
       cloth.BendingConstraints.SetActiveConstraints();
       cloth.UpdateDeformableTriangles();
       cloth.Solver.UpdateActiveParticles();
   }
Reply
#2
Alright I've guessed the last id. It's 110. I'd still like to know if there's a better way to figure it out, than guessing Sonrisa
Reply