Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Upgrading version 4 code (esp. GetConstraintsInvolvingParticle)
#2
Hi there!

The 3 calls above are no longer necessary. Actors are automatically added to the first solver up their hierarchy, no need to call AddToSolver() manually. Also, the solver stores some "dirty" flags which automatically update active constraints or particles when necessary, so no need for SetActiveConstraints() or UpdateActiveParticles().

Regarding batch.GetConstraintsInvolvingParticle(), it was removed due to how inefficient it is (linear search trough all constraints in the cloth). Note you can still reimplement it if you want, it just iterates trough all constraints in the batch checking its particleIndices array for references to that particle. Each distance constraint references 2 particles, so something like:

Code:
for (int i = 0; i < activeConstraintCount; ++i)
{
if (particleIndices[i*2] == particleIndex || particleIndices[i*2+1] == particleIndex)
    affectedConstraints.Add(i/2);
}
Reply


Messages In This Thread
RE: Upgrading version 4 code (esp. GetConstraintsInvolvingParticle) - by josemendez - 10-05-2022, 09:32 AM