Unity 梯子生成算法
来源:互联网 发布:免id下载软件 编辑:程序博客网 时间:2024/04/29 14:24
这位同学太有才了,写得都非常好- -
http://www.cnblogs.com/wuzhang/p/wuzhang20150409.html
using UnityEngine;public class PadelCreate : MonoBehaviour{ public GameObject prb_padel; public float angel = 30; public int leftCount = 50; public int rightCount = 50; private Vector3 lastOnePosition; void Start() { if (prb_padel == null) prb_padel = GameObject.CreatePrimitive(PrimitiveType.Cube); anyAngelPadel(angel); } /// <summary> /// 任意角度的楼梯实例 /// </summary> /// <param name="angel"></param> void anyAngelPadel(float angel) { float hudu = (angel / 180) * Mathf.PI; //上楼梯 for (int i = 0; i < leftCount; i++) { GameObject tmpPadel = (GameObject)Instantiate(prb_padel); float yy = i * Mathf.Tan(hudu); tmpPadel.transform.position = new Vector3(-7 + i, -2 + yy, 0); lastOnePosition = tmpPadel.transform.position; } //水平方向生成两个 for (int i = 0; i < 2; i++) { GameObject tmpPadel = (GameObject)Instantiate(prb_padel); tmpPadel.transform.position = new Vector3(lastOnePosition.x + 1, lastOnePosition.y, 0); lastOnePosition = tmpPadel.transform.position; } //下楼梯 for (int i = 0; i < rightCount; i++) { GameObject tmpPadel = (GameObject)Instantiate(prb_padel); float yy = i * Mathf.Tan(hudu); tmpPadel.transform.position = new Vector3(lastOnePosition.x + i, lastOnePosition.y - yy, 0); //lastOnePosition = tmpPadel.transform.position; } }}
50*50
6*6
0 0
- Unity 梯子生成算法
- 梯子
- 动态规划算法求解上梯子问题
- 梯子记录
- 梯子意识
- 梯子意识
- unity C#生成楼梯
- unity 生成assetbundle文件
- Unity生成.assets
- Unity脚本生成图片
- Unity生成二维码功能
- unity生成代码模板
- 二维码 生成 unity
- Unity生成二维码
- Unity Mesh生成图形
- Unity中生成二维码
- Unity生成Excel表
- unity生成怪物
- zeppelin 初使用
- Redis教程(七) HyperLogLog类型
- sybase 动态sql
- Spring Boot 运行原理
- EL表达式中截取字符串的长度
- Unity 梯子生成算法
- 三.Spring配置文件详解随笔
- 购物神器:一款自动抓取淘宝商品内部优惠券的工具 http://www.bcyhq.cn/search.html
- it基础设施原理
- android 常用Adapter复制就用
- Redis教程(八) GEO地理位置
- c++之各种继承(单继承,多继承,菱形继承)
- 在Eclipse添加Android兼容包( v4、v7 appcompat )
- Spring 架构篇——基于 WebSocket 的消息推送