UnityEngine.Mathf.RoundToInt C# (CSharp) Method

RoundToInt() public static method

public static RoundToInt ( float f ) : int
f float
return int
        public static int RoundToInt(float f)
        {
            return (int)Math.Round(f);
        }

Usage Example

コード例 #1
0
        /** Convert from voxel coordinates to world coordinates.
         * (0,0,0) in voxel coordinates is a bottom corner of the bounding box.
         * (1,0,0) is one voxel in the +X direction of that.
         */
        public Int3 VoxelToWorldInt3(Int3 voxelPosition)
        {
            var pos = voxelPosition * Int3.Precision;

            pos = new Int3(Mathf.RoundToInt(pos.x * cellScale.x), Mathf.RoundToInt(pos.y * cellScale.y), Mathf.RoundToInt(pos.z * cellScale.z));
            return(pos + (Int3)voxelOffset);
        }
All Usage Examples Of UnityEngine.Mathf::RoundToInt