Obi Official Forum
Remove Stitches/Stitcher From Cloth - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html)
+--- Thread: Remove Stitches/Stitcher From Cloth (/thread-2999.html)



Remove Stitches/Stitcher From Cloth - Visitor245262 - 01-07-2021

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!