您的位置:首页 > 移动开发 > Unity3D

楼梯,梯度递增,计算代码-unity3D

2016-06-14 00:00 381 查看
using UnityEngine;
using System.Collections;

public class LTScript : MonoBehaviour {
public GameObject LTPrefab;
private float angle=45;
// Use this for initialization
void Start () {
for(int i=0;i<10;i++){
GameObject obj 	 = (GameObject) GameObject.Instantiate(LTPrefab);
float hudu=(angle/180)*Mathf.PI;
float yy=i*Mathf.Tan(hudu);
obj.transform.position = new Vector3 (5*i,2*yy,0);

}

}

// Update is called once per frame
void Update () {

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: