Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Tear, Pin, Cut, Fold and Mark
#10
(13-01-2022, 09:37 AM)josemendez Wrote: Hi there!


ObiSolver.simplices contains simplex indices. A simplex is a convex shape made up of 1, 2, or 3 particles (point, edge, or triangle respectively). In the case of cloth, a simplex is always 1 particle (if not using surface collisions) or 3 particles (if using surface collisions).

Once you get a simplex index, you need to retrieve the particle indices in it. This is done using ObiSolver.simplexCounts.GetSimplexStartAndSize(simplexIndex, simplexSize);

This is all thoroughly documented and explained here with sample code (see "Retrieving the particle involved in a contact"):
http://obi.virtualmethodstudio.com/manua...sions.html


There's no direct map from a particle index to a batch and constraint index, because one particle might be involved in an arbitrary number of constraints. It's not a 1-1 relationship. The only way to find a constraint given a particle index is to iterate trough all constraints until you find the one(s) that involve that particle. See:

http://obi.virtualmethodstudio.com/manua...aints.html

let me know if I can be of further help. Sonrisa

Ok let's say I have 
    int startPatical = solver.simplexCounts.GetSimplexStartAndSize(results.simplexIndex, out int simplexSize);
I'm assuming I can use "startPatical" as a reference to compare with all the particles in a constraint? So first, I just wanna confirm if "startPatical" is the correct parameter I can use?

Then let's say I get the batches
    var dc = GetConstraintsByType(Oni.ConstraintType.Distance) as ObiConstraints<ObiDistanceConstraintsBatch>;
    var theFirstBatch = dc.batches[0] as ObiDistanceConstraintsBatch;

There I want to find if "startPatical" is in one of the constraint in "theFirstBatch" right? OK, let's iterate through it.
    for (int i = 0; i < theFirstBatch.constraintCount; i++){
             //here how do I get a constraint?
             //and how do I check if startPatical is in that constraint?
    }
OK how do I get a constraint from the batch? There's no "theFirstBatch.ActiveConstraints[i]" or "theFirstBatch.GetConstraint(int index)", so how do I get each constraint object from the batch by iteration? And after that, how do I test if "startPatical" is in a constraint?

Please advice, thx.
Reply


Messages In This Thread
Tear, Pin, Cut, Fold and Mark - by Valerize - 06-01-2021, 11:35 AM
RE: Tear, Pin, Cut, Fold and Mark - by josemendez - 06-01-2021, 01:04 PM
RE: Tear, Pin, Cut, Fold and Mark - by Valerize - 07-01-2021, 09:03 PM
RE: Tear, Pin, Cut, Fold and Mark - by Valerize - 16-03-2021, 06:17 PM
RE: Tear, Pin, Cut, Fold and Mark - by josemendez - 17-03-2021, 08:54 AM
RE: Tear, Pin, Cut, Fold and Mark - by Valerize - 18-03-2021, 10:21 AM
RE: Tear, Pin, Cut, Fold and Mark - by josemendez - 18-03-2021, 10:55 AM
RE: Tear, Pin, Cut, Fold and Mark - by cycle6 - 13-01-2022, 01:58 AM
RE: Tear, Pin, Cut, Fold and Mark - by josemendez - 13-01-2022, 09:37 AM
RE: Tear, Pin, Cut, Fold and Mark - by cycle6 - 13-01-2022, 10:31 AM
RE: Tear, Pin, Cut, Fold and Mark - by josemendez - 13-01-2022, 10:50 AM
RE: Tear, Pin, Cut, Fold and Mark - by cycle6 - 13-01-2022, 11:04 AM
RE: Tear, Pin, Cut, Fold and Mark - by josemendez - 13-01-2022, 11:36 AM