Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Trying to add DistanceConstraint for my TearableCloth but getting IndexOutOfRange
#6
(28-07-2022, 07:19 PM)snowtv Wrote: I think I'm adding them to the solver?

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:

Quote:After you've added or removed constraints, you will need to call actor.SetConstraintsDirty(). This rebuilds all solver batches of the given constraint type.


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()!.
Reply


Messages In This Thread
RE: Trying to add DistanceConstraint for my TearableCloth but getting IndexOutOfRange - by josemendez - 29-07-2022, 07:59 AM