Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  I want to control the SkinCompliance of individual particles from a script.
#4
Hi there,

The cause of the crash is your "GrabberTrigger" script: there's an out of bounds access on the skinCompliance native arrays, since these are unmanaged arrays you're overwriting whatever the contents of memory are outside of the array. No bounds checks are performed for unmanaged memory, so you must be *extra* careful. Writing outside of the allocated memory can cause crashes, freezes, and all sorts of problems.

The documentation for the skinCompliance array says:
Quote:One compliance value per skin constraint.

So if there's say, 1200 constraints, this array is 1200 entries long. For some reason you're accessing the second value out of every 3:

Code:
solverSkinBatch.skinCompliance[index * 3 + 2] = 0.0f;

Which would be correct for skinRadiiBackstop (since it contains 3 values for each constraint, being 3 times as long), but not for skinCompliance.
This code writes "0" outside of the array. Depending on what the memory adjacent to the array is being used for, the results will vary, but almost always you will get a crash or a freeze.

Access skinCompliance correctly, like this:
Code:
solverSkinBatch.skinCompliance[index] = 0.0f;
Reply


Messages In This Thread
RE: I want to control the SkinCompliance of individual particles from a script. - by josemendez - 13-10-2021, 09:51 AM