using UnityEngine;
using System.Collections;
public class YScript : MonoBehaviour {
public GameObject cm;
private float angle=0;
private float r=5;
// Use this for initialization
void Start () {
Vector3 center = new Vector3(0,0,0);
for (int i=0; i<36; i++) {
GameObject cube= GameObject.CreatePrimitive(PrimitiveType.Cube);
float hudu=(angle/180)*Mathf.PI;
float xx=center.x+r*Mathf.Sin(hudu);
float yy=center.y+r*Mathf.Cos(hudu);
cube.transform.position=new Vector3(xx,yy,0);
cube.transform.LookAt(cm.transform.position);
angle+=10;
}
}
// Update is called once per frame
void Update () {
}
}
UNITY3D圆形算法
最新推荐文章于 2022-08-31 11:17:05 发布