Freeze bug in the Collisions sample

I found a bug in the sample linked from the documentation.

If left unattended for several minutes, it seems to enter an infinite loop and freeze.

I think lines 168 and 199 are unnecessary.

p = spheresPerShapeNb*particleGroup + spheresPerShapeNb - 1

I am not able to repro, maybe @jerome the SPS daddy or @Evgeni_Popov ?

In the case where this problem occurs, it seems that the loop counter is erroneously reset when the process in the red frame is called, leading to an infinite loop of the for statement.

This faulty event will occur if left unattended for several minutes.
To reproduce this problem, I would increase the speed of particleMaxSpeed by a factor of 10 and it will reproduce in a few seconds.

//var particleMaxSpeed = 0.5; //distance per frame
var particleMaxSpeed = 0.5 * 10; //distance per frame

I do reproduce with maxSpeed=5.

I don’t really know what the fix is, though… Is it to simply remove the line or to do a break?

1 Like

I could not figure out what the code meant in the problem area, but at least it seemed to work correctly when removed.

I couldn’t either, so let’s wait for @jerome if he is around, else we will probably remove the line.

1 Like

I just read the code of this PG. I can’t remember to have coded this. I guess it’s not mine and I have no idea about what it does actually (I just did the examples in the SPS internal doc).
As the SPS is physics agnostic, I think this PG’s bug is related to this PG’s physics behavior specifically.

Sorry, I can’t help that much

Do we all agree to just remove the line ???

Done, will be deployed in a bit.

2 Likes

Thank you for your correction. Confirmed that the samples linked to in the documentation no longer freeze.