I had two identical blocks of code (different variable names), one worked, the other not quite.
Straightforward for loops, iterating through an array. The ‘z’ variable is used in calculations within the loop.
This loop worked perfectly:
for(var z = 0.0; z < zDim; z++)
While this loop iterated through the array, setting the same value every time.
for(var z = 0; z < zDim; z++)
The only difference is the decimal point. All my other loops seem to work no problem with simple integers. Inside the loops, calculations are made with a mixture of ints and floats. I know my code works, although it would be awesome if somebody could help me understand why.