Vector3 getRadiusPosition(PolygonVertexInfo info, int index, float scale=1f) { if (vertexInfoList.Count < 3) return Vector3.zero; float width = rectTransform.rect.width / 2 * info.length ; float height = rectTransform.rect.height / 2 * info.length ; float angleUnit = 2f * Mathf.PI / vertexInfoList.Count; float offsetToAngle = offset / 360 * Mathf.PI * 2; Vector3 result = new Vector3(width * Mathf.Cos(angleUnit * index + offsetToAngle), height* Mathf.Sin(angleUnit* index + offsetToAngle)); return result * scale; }
Vector3 getRadiusPosition(PolygonVertexInfo info, int index, float scale = 1f) { if (vertexInfoList.Count < 3) { return(Vector3.zero); } float width = rectTransform.rect.width / 2 * info.length; float height = rectTransform.rect.height / 2 * info.length; float angleUnit = 2f * Mathf.PI / vertexInfoList.Count; float offsetToAngle = offset / 360 * Mathf.PI * 2; Vector3 result = new Vector3(width * Mathf.Cos(angleUnit * index + offsetToAngle), height * Mathf.Sin(angleUnit * index + offsetToAngle)); return(result * scale); }