The round function returns the rounded value of the argument. This means that the function will cut off all floating point values of the argument and return an integer instead. Values with a floating point value above 0.5 will be rounded up to the next higher integer - e.g. the argument 2.6 will return the value 3. Values with a floating point value below 0.5 will be rounded down to the next lower integer - e.g. the argument 2.4 will return 2. We show this by using a sine function as an argument for the round function
sphere.YPosition = round( sin( time * 90 ) * 2 );
This will convert the wave to stairsteps.
|