10-06-2025, 10:21 AM
(This post was last modified: 10-06-2025, 10:24 AM by josemendez.)
(10-06-2025, 08:31 AM)alicecatalano Wrote: this is always false, even when visually i can see it happens.
Note that your code will return false as long as the last particle you check is outside the bounds: you're overwriting the value of the "inBound" variable every iteration and never stopping the loop. Not sure if this is intentional or not but it sure looks wrong.
In case you want to check whether *any* particle is inside the bounds, the proper way to do it would be immediately returning true from inside the for loop as soon as you find a particle inside. Otherwise, return false at the end of the method once you've checked all particles and know none of them are inside the bounds.
kind regards.