If (period == 0) { period = 0.01; }

cu2_s03_protecting_against_nan

#1

Negative numbers on the period float didn’t seem to make any difference to operation of the code, so cutting out the NaN seemed the simplest way


#2

I think that period=0 needs to be an option (i.e. stationary object).

Also, bear in mind that a really small period = high frequency waveform = very fast moving object. If you want a very slow object that appears to be not movinng at all (emulating zero) then you need a very high value for period (like 1000000f).


#3

I think I just had a ‘rubber duck’ situation. Reasoning it out, period=0 would not, as I previously thought, be a stationary object, it would be an infinitely fast moving object. This is probably not desirable from any point of view, gamplay design or otherwise. So yeah, maybe auto-adjusting to something extremely fast but finite would probably be better.