/// <summary> /// 根据半径随机出园内的点 /// </summary> /// <param name="vRadius"></param> /// <returns></returns> public static Vector2 GetRandomInCircle(float vRadius) { var randomValue = Random.Range(0f, 1f); var r = Mathf.Sqrt(randomValue) * vRadius; randomValue = Random.Range(0f, 1f); var theta = 2 * Mathf.PI * randomValue; //生成x,y坐标, var x = r * Mathf.Cos(theta); var y = r * Mathf.Sin(theta); return new Vector2(x, y); }
标签:一个点,vRadius,Mathf,unity,圆内,var,theta,随机,randomValue From: https://www.cnblogs.com/Colored-Mr/p/17679664.html