UnityEngine.Mathf.Repeat C# (CSharp) Method

Repeat() public static method

public static Repeat ( float t, float length ) : float
t float
length float
return float
        public static float Repeat(float t, float length)
        {
            return (float) (t - Math.Floor(t / length) * length);
        }

Usage Example

コード例 #1
0
    private void GenerateBaseValues()
    {
        if (fromDegrees)
        {
            radians = (degrees * M.PI) / 180;
        }
        else
        {
            degrees = (radians * 180) / M.PI;
        }

        //If allowed, use time as input.
        t = (float)EditorApplication.timeSinceStartup;
        if (useTime)
        {
            radians = t;
            degrees = degrees = (radians * 180) / M.PI;
        }

        //Clamp the values to a readable range
        radians = M.Repeat(radians, 2 * M.PI);
        degrees = M.Repeat(degrees, 360);

        //local variables for simplicity
        sine    = M.Sin(radians);
        cosine  = M.Cos(radians);
        tangent = M.Tan(radians);
    }
All Usage Examples Of UnityEngine.Mathf::Repeat