18-06-2018, 03:09 PM
(This post was last modified: 18-06-2018, 03:10 PM by josemendez.)
Hi,
According to the dump file, the crash happens when setting pin constraints due to an out of bounds access. There are multiple errors in your code that could lead to this:
There's no point in comparing a particle index with the amount of constraints in a batch. They're just two different things, a rope could have few particles and many constraints or viceversa.
You are passing a particle index, when you should be passing a constraint index. Since no range checks are performed in Obi, this results in undefined behavior (including the possibility of a crash) as warned in the documentation.
If you want to remove the constraint affecting a certain particle, use GetConstraintsInvolvingParticle(particleIndex) to find out the appropriate constraint index.
According to the dump file, the crash happens when setting pin constraints due to an out of bounds access. There are multiple errors in your code that could lead to this:
Quote: if (batch != null && RopeParticleIndex < batch.ConstraintCount)
There's no point in comparing a particle index with the amount of constraints in a batch. They're just two different things, a rope could have few particles and many constraints or viceversa.
Quote:batch.RemoveConstraint(RopeParticleIndex);
You are passing a particle index, when you should be passing a constraint index. Since no range checks are performed in Obi, this results in undefined behavior (including the possibility of a crash) as warned in the documentation.
If you want to remove the constraint affecting a certain particle, use GetConstraintsInvolvingParticle(particleIndex) to find out the appropriate constraint index.