Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
softbody cut
#9
There was 2 problem:
1.How do you get a constraint between two particles?
Are P1 and P2 just two particles of the same constraint?

Code:
        var dc = softbody.GetConstraintsByType(Oni.ConstraintType.ShapeMatching) as ObiConstraints<ObiShapeMatchingConstraintsBatch>;
        var sc = softbody.solver.GetConstraintsByType(Oni.ConstraintType.ShapeMatching) as ObiConstraints<ObiShapeMatchingConstraintsBatch>;
        sc.RemoveFromSolver();
        for (int j = 0; j < dc.batches.Count; ++j)
        {
            var batch = dc.batches[j];
            Debug.Log("The number of particles in each bound batch:" + j + "/" + batch.numIndices.count);
            var solverBatch = sc.batches[j];
            int offset = softbody.solverBatchOffsets[(int)Oni.ConstraintType.ShapeMatching][j];
            for (int i = 0; i < batch.activeConstraintCount; i++)
            {
               
                int index = i + offset;
                int p1 = batch.particleIndices[i * 2];
                int p2 = batch.particleIndices[i * 2 + 1];

                int or1 = softbody.solverIndices[p1];
                int or2 = softbody.solverIndices[p2];
                //Get particle position
                Vector3 pos1 = softbody.solver.positions[or1];
                Vector3 pos2 = softbody.solver.positions[or2];
                ....
            }
        }

        sc.AddToSolver(softbody.solver);

2.solverBatch.RemoveParticleFromConstraint
What does it do?
Reply


Messages In This Thread
softbody cut - by Seahorse - 15-12-2022, 05:16 AM
RE: softbody cut - by josemendez - 15-12-2022, 12:40 PM
RE: softbody cut - by Seahorse - 15-12-2022, 01:50 PM
RE: softbody cut - by josemendez - 15-12-2022, 02:59 PM
RE: softbody cut - by Seahorse - 15-12-2022, 03:13 PM
RE: softbody cut - by josemendez - 15-12-2022, 03:24 PM
RE: softbody cut - by Seahorse - 15-12-2022, 03:28 PM
RE: softbody cut - by josemendez - 15-12-2022, 03:41 PM
RE: softbody cut - by Seahorse - 19-12-2022, 12:19 PM
RE: softbody cut - by josemendez - 19-12-2022, 12:30 PM
RE: softbody cut - by manurocker95 - 20-07-2023, 12:14 PM
RE: softbody cut - by josemendez - 25-07-2023, 09:33 AM