I want to change My Float from 1.0005 to 1
now in Java one could do this
float = float * 10000;
float = (int) float/10000;
this would cast the float as an integer doing integer division allowing my float to end after so many decimals.
How do I do this in Java Script?
You can use a DotNet function or one of these Mathf class function:
CeilToInt(f : float) - Returns the smallest integer greater to or equal to f.
FloorToInt(f : float) - Returns the largest integer smaller to or equal to f.
RoundToInt(f : float) - Returns f rounded to the nearest integer.
print(Mathf.CeilToInt(1.0005)) //print 1