Unity3D动态创建摄像机
发布日期:2021-06-30 19:37:44
浏览次数:3
分类:技术文章
本文共 820 字,大约阅读时间需要 2 分钟。
摄像机本身的depth越大,则它所渲染的东西越靠顶
public GameObject CameraObj;public const int CAM_DEPTH = 2;public const int CAM_LAYER = 5;public void CreateCamere(){ CameraObj = new GameObject("myCamera"); Camera cam = CameraObj.AddComponent(); cam.transform.localPosition = Vector3.zero; cam.transform.localScale = Vector3.one * 0.002777778f; cam.depth = CAM_DEPTH; cam.cullingMask = 1 << CAM_LAYER; cam.gameObject.layer = CAM_LAYER; cam.clearFlags = CameraClearFlags.Depth; cam.orthographic = true; //投射方式:orthographic正交// cam.orthographicSize = 1; //投射区域大小// cam.nearClipPlane = -2.7f; //前距离// cam.farClipPlane = 2.92f; //后距离// cam.rect = new Rect(0, 0, 1f, 1f); UICamera uiCam = CameraObj.AddComponent (); uiCam.eventReceiverMask = 1 << CAM_LAYER;}
转载地址:https://linxinfa.blog.csdn.net/article/details/46363649 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月23日 03时58分35秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
how2heap-fastbin_dup_consolidate
2019-04-30
orw_shellcode_模板
2019-04-30
[fmt+shellcode]string
2019-04-30
fmt在bss段(neepusec_easy_format)
2019-04-30
[double free] 9447 CTF : Search Engine
2019-04-30
python 函数式编程
2019-04-30
python编码
2019-04-30
scala maven plugin
2019-04-30
flink 1-个人理解
2019-04-30
redis cli
2019-04-30
redis api
2019-04-30
flink physical partition
2019-04-30
java 解析json
2019-04-30
java http请求
2019-04-30
tensorflow 数据格式
2019-04-30
tf rnn layer
2019-04-30
常用中间件
2019-04-30
tf input layer
2019-04-30
tf model create
2019-04-30