美文网首页
Unity中的Mathf类

Unity中的Mathf类

作者: 困卡 | 来源:发表于2017-03-15 23:27 被阅读0次

Mathf类

这是一个数学类Mathf,使用它可以轻松解决复杂的数学公式。提供了常用的数学运算。

Paste_Image.png Time类与Mathf类讲解.png
     void OnGUI()
    {
        GUILayout.Label( "Abs:"+ Mathf.Abs(-6.9f));
        GUILayout.Label("Pow:"+Mathf.Pow(5,2));
        GUILayout.Label("Sqrt:"+Mathf.Sqrt(6.9f));
        GUILayout.Label("Clamp:"+Mathf.Clamp(6.9f,3f,9f));
        GUILayout.Label("Floor:" + Mathf.Floor(6.9f));
        GUILayout.Label("Ceil:" + Mathf.Ceil(6.9f));
        GUILayout.Label("Round:"+Mathf.Round(6.9f));
        GUILayout.Label("Min:"+Mathf.Min(6,45f,1f,8f,64f,14f,3f));
        GUILayout.Label("sin:"+Mathf.Sin(45f)+"cos:"+Mathf.Cos(45f)+"tan:"+Mathf.Tan(45f));

    }
UQ~Z(EWJWR[FH]6MFNG0HYV.png

相关文章

网友评论

      本文标题:Unity中的Mathf类

      本文链接:https://www.haomeiwen.com/subject/fftdnttx.html