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

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

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).

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.

Privacy & Terms