You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using the code from the article, I ran into an issue where somewhat regularly, the thing I shake (I have genericized it to not just shake a camera, but anything with an offset), it will blow out the offset values beyond NAN. I have tracked this down to the following code, and fixing this has fixed it, but I am opening this to make sure you agree. I can assert that the bug happens most often for the y-value, which makes sense, since the majority of integers are above 1/3 the max value of the integer type. For the following code:
When multiplying the seed by 2 or 3, you must ensure that noise.seed is less than half or a third (respectively) of the max value of the int type - without that, it seems like it's going above the max value of the int type and resulting in NAN when multiplied. To fix it, I simply divided the original value when it was set, like so:
This should still result in a fairly randomized value, and if anyone notices the visual effect, I'd be stunned. Since this is more of a fix of exclusion, i.e. it doesn't seem to happen anymore but can't say it doesn't happen forever, I didn't want to submit a PR yet. If you feel the above fix should work, or if you don't think the bug I found is the problem, let me know!
The text was updated successfully, but these errors were encountered:
While using the code from the article, I ran into an issue where somewhat regularly, the thing I shake (I have genericized it to not just shake a camera, but anything with an offset), it will blow out the offset values beyond NAN. I have tracked this down to the following code, and fixing this has fixed it, but I am opening this to make sure you agree. I can assert that the bug happens most often for the y-value, which makes sense, since the majority of integers are above 1/3 the max value of the integer type. For the following code:
When multiplying the seed by 2 or 3, you must ensure that noise.seed is less than half or a third (respectively) of the max value of the int type - without that, it seems like it's going above the max value of the int type and resulting in NAN when multiplied. To fix it, I simply divided the original value when it was set, like so:
This should still result in a fairly randomized value, and if anyone notices the visual effect, I'd be stunned. Since this is more of a fix of exclusion, i.e. it doesn't seem to happen anymore but can't say it doesn't happen forever, I didn't want to submit a PR yet. If you feel the above fix should work, or if you don't think the bug I found is the problem, let me know!
The text was updated successfully, but these errors were encountered: