Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
softbody cut
#10
(19-12-2022, 12:19 PM)Seahorse Wrote: There was 2 problem:
1.How do you get a constraint between two particles?

You don't.

Or more, precisely: you iterate trough all constraints in all batches until you find the one that references the two particles you're looking for. This is of course extremely slow, but neither simulation or tearing need to know which constraints affect a specific particle: you only need to know which particles are involved in each constraint. At no point you need to map particles-->constraint, it's always constraint-->particles.

You shouldn't need to do this for softbody cutting. What you do is you iterate trough all constraints just once per frame, and for each constraint you determine whether it's involved in a cut or not, then update it accordingly.

(19-12-2022, 12:19 PM)Seahorse Wrote: Are P1 and P2 just two particles of the same constraint?

You're mixing up distance and shape matching constraints here, shape matching constraints generally have more than 2 particles per constraint. You're supposed to use the firstIndex and numIndex arrays to retrieve the list of particles in each constraint. See the API documentation for shape matching batches:

Quote:firstIndex:  first particle in each constraint.
numIndex: amount of particles in each constraint.

So to the indices of the particles in constraint #5 are found in the <firstIndex[5], firstIndex[5]+numIndex[5]> range of entries in batch.particleIndices. If you've used Flex's API before, this works the exact same way.

(19-12-2022, 12:19 PM)Seahorse Wrote: 2.solverBatch.RemoveParticleFromConstraint
What does it do?

It's pretty self-explanatory: it removes a particle from the constraint, so it's no longer affected by it.
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