Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Trying to add DistanceConstraint for my TearableCloth but getting IndexOutOfRange
#21
(10-08-2022, 07:35 PM)snowtv Wrote: Thanks for the reply. You are correct that I hard-coded some vertex indices for the process. However, you can see that my method is looking up for the solver index for the particle that is closest to each of the vertex, then passing the particle indices to the AddConstraint().

Yes, my bad. I understand what you're doing now. Not sure why the out of bounds exception, but it's happening inside the constraint evaluation method so one or more indices passed to it are wrong in some way.

(10-08-2022, 07:35 PM)snowtv Wrote: Plus if my method is getting out of bound error, it doesn't make sense that you didn't encounter the same error on your side.

When testing your project, I hadn't installed any extra packages so Obi was using the fallback backend (Oni). Since it does not perform any out of bounds checks, the error passed undetected. But as I previously mentioned it's dangerous nonetheless, as it's writing outside the allocated memory for the arrays and that's undefined behavior.

Testing again using the Burst backend and Jobs Debugger enabled, I got the same error as you did.

(10-08-2022, 07:35 PM)snowtv Wrote: Is it possible to send a copy of the script modified by you?

In my previous post you have my modified version of the AttachParticlePairInColon() function. It works without errors, constraints are persistent (even if you add/remove actors from the solver) and it's faster since it does not require to loop over all particles in the solver to find the closest to a vertex: it uses the mesh topology to look it up in constant time.

Let me know if I can be of further help,
Reply


Messages In This Thread
RE: Trying to add DistanceConstraint for my TearableCloth but getting IndexOutOfRange - by josemendez - 10-08-2022, 08:19 PM