Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Trying to add DistanceConstraint for my TearableCloth but getting IndexOutOfRange
#7
(29-07-2022, 07:59 AM)josemendez Wrote: Yes you're adding them to the solver, but at the very end you're asking the solver to rebuild all distance constraint batches, by calling SetConstraintsDirty(). From the docs:



So what's happening is that you're adding a new constraint to the solver batches, and then asking the solver to discard all existing distance batches and rebuild them by merging batch data from all actors in the solver.

Either add the constraint to the actor blueprint (useful if you want to later instantiate the actor multiple times), or add the constraint to the solver if it's a one-time thing. In this case, don't call SetConstraintsDirty()!.


I thought it's necessary to SetConstraintsDirty() because when adding new constraint to a batch it's possible that the new constraint contains particles that are already in that batch?

I know it's not the case for my issue because I'm adding a constraint to a new batch and adding the new batch to the solver, so I'm guessing it's ok to have as many batches as you need?

Also why rebuilding batches will render the constraints useless? I thought it only changed how the constraint data is arranged in the batches, but the actual data which affects the physics behavior won't be different?



Just to update, I commented out the line that calls SetConstraintsDirty(), still don't see a difference...
Reply


Messages In This Thread
RE: Trying to add DistanceConstraint for my TearableCloth but getting IndexOutOfRange - by snowtv - 29-07-2022, 07:27 PM