Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove Stitches/Stitcher From Cloth
#1
In v3.5 what is the correct process for removing stitches from the cloth? Then switching one cloth to a different solver? I only need one piece of cloth to simulate at a time after the stitch is removed.

1. To add the stitch I use:
plyStitcher.PullDataFromSolver ();
plyStitcher.AddStitch (61, 8);
plyStitcher.PushDataToSolver ();


2. To remove the stitch I use:
plyStitcher.PullDataFromSolver ();
plyStitcher.RemoveStitch (0);
plyStitcher.PushDataToSolver ();

plyStitcher.Actor2 = null;
plyStitcher.Actor1 = null;


3. To switch solvers I use:
ply2.RemoveFromSolver (null);
ply2.Solver = ply2Solver;
ply2.AddToSolver (null);


4. ply2.RemoveFromSolver (null) causes this error:
NullReferenceException: Object reference not set to an instance of an object
Obi.ObiStitcher.RemoveFromSolver (System.Object info) (at Assets/Plugins/Obi/Scripts/Actors/ObiStitcher.cs:203)
Obi.ObiStitcher.Actor_OnRemovedFromSolver (System.Object sender, Obi.ObiActorSolverArgs e) (at Assets/Plugins/Obi/Scripts/Actors/ObiStitcher.cs:156)
Obi.ObiActor.RemoveFromSolver (System.Object info) (at Assets/Plugins/Obi/Scripts/Actors/ObiActor.cs:342)
Obi.ObiCloth.RemoveFromSolver (System.Object info) (at Assets/Plugins/Obi/Scripts/Actors/ObiCloth.cs:224)


If I run RemoveFromSolver/AddToSolver code again it does work with no errors, so I must be missing a step somewhere but cant figure it out. Thanks!
Reply