我希望下面看到的紫色圆圈像第二张图像一样旋转。
问题 - 正如你所看到的 - 是圆圈变形了。我知道为什么,
这是第一张图片的代码
Vector3 pos = new Vector3 (radius * Mathf.Cos (theta), radius * Mathf.Sin (theta), 0f);
我将第二个参数切换为第三个,并且排序工作(如您所见,紫色圆圈变形)。
Vector3 pos = new Vector3 (radius * Mathf.Cos (theta), 0f, radius * Mathf.Sin (theta));
private void Circle() {
lineRenderer.widthMultiplier = lineWidth;
float deltaTheta = (2f * Mathf.PI) / vertexCount;
float theta = 0f;
lineRenderer.positionCount = vertexCount;
for (int i = 0; i < lineRenderer.positionCount; i++) {
Vector3 pos = new Vector3 (radius * Mathf.Cos (theta), 0f, radius * Mathf.Sin (theta));
lineRenderer.SetPosition (i, pos);
theta += deltaTheta;
}
}