Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Access violation crash!
#2
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:

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.
Reply


Messages In This Thread
Access violation crash! - by M. Hanssen - 18-06-2018, 12:09 PM
RE: Access violation crash! - by josemendez - 18-06-2018, 03:09 PM
RE: Access violation crash! - by M. Hanssen - 19-06-2018, 10:50 AM
RE: Access violation crash! - by josemendez - 21-06-2018, 08:33 AM
RE: Access violation crash! - by M. Hanssen - 25-06-2018, 08:13 AM
RE: Access violation crash! - by M. Hanssen - 27-06-2018, 09:16 AM
RE: Access violation crash! - by josemendez - 27-06-2018, 05:04 PM
RE: Access violation crash! - by M. Hanssen - 09-07-2018, 01:13 PM
RE: Access violation crash! - by M. Hanssen - 27-07-2018, 11:16 AM