当前位置:网站首页>Unity determines whether the object is in the camera field of view
Unity determines whether the object is in the camera field of view
2022-06-11 02:27:00 【Xia 78】
private bool IsInView(Transform tran)
{
Transform camTransform = GameCamMgr.S.gameplayCamera.transform;
Vector2 viewPos = GameCamMgr.S.gameplayCamera.WorldToViewportPoint(tran.position);
Vector3 dir = (tran.position - camTransform.position).normalized;
float dot = Vector3.Dot(camTransform.forward, dir);// Determine whether the object is in front of the camera
if (dot>0&&viewPos.x >= 0 && viewPos.x <= 1 && viewPos.y >= 0 && viewPos.y <= 1)
return true;
else
{
//Log.e("x_{0}, y_{1}",viewPos.x,viewPos.y);
return false;
}
}
```
边栏推荐
- Go develop web
- Mentality cannot collapse
- 金属有机骨架材料Fe-MIL-53,Mg-MOF-74,Ti-KUMOF-1,Fe-MIL-100,Fe-MIL-101)负载异氟醚/甲氨蝶呤/阿霉素(DOX)/紫杉醇/布洛芬/喜树碱
- 年金保险理财产品可以复利吗?利率是多少?
- Binary tree sequence traversal
- Why is the trend chart of precious metal silver strong?
- Implementing queues with stacks
- [C language] storage of data in memory -1 plastic
- Bingbing learning notes: find the greatest common divisor and the least common multiple. Complex version reverse string
- 浅析直播间海量聊天消息的架构设计难点
猜你喜欢

Unity serial port communication

Principle of everything for fast search

421. 数组中两个数的最大异或值

The interviewer of Tencent said that who knows the internal module index principle and performance optimization idea of MySQL architecture?

During SSH configuration key login, you need to pay attention to whether the private key is set with a password

Jetpack Compose Scaffold和BottomAppBar(底部导航)

10 years of domestic milk powder counter attack: post-90s nannies and dads help new domestic products counter attack foreign brands

大厂测试员年薪30万到月薪8K,吐槽工资太低,反被网友群嘲?

C language principle explanation and code implementation of scalable / reduced thread pool

可扩/减容线程池C语言原理讲解及代码实现
随机推荐
27岁女生零基础转行软件测试,合适吗?
Bingbing learning notes: find the greatest common divisor and the least common multiple. Complex version reverse string
为什么有的程序员能力一般却能拿到好offer?
SD3.0笔记
Koa2 learning notes
The annual salary of testers in large factories ranges from 300000 to 8K a month. Roast complained that the salary was too low, but he was ridiculed by netizens?
环糊精金属有机骨架(β-CD-MOF)装载二巯丁二酸/大黄素/槲皮素/三氯蔗糖/二氟尼柳/奥美拉唑(OME)
GCC C内联汇编
koa2学习笔记
C language principle explanation and code implementation of scalable / reduced thread pool
Customized redistemplate in redis
Shader of double sided material
Analysis of the difficulties in the architecture design of massive chat messages in the live broadcast room
SQL | 外连接
Test questions and answers of 2022r1 quick opening pressure vessel operation certificate
Find - (sequential search)
In the past 10 years, from zero foundation testing to test architect, he has made himself successful
Wechat automatic red envelope grabbing source code
金属有机框架MOF-Al(DIBA),MOF-Zr(DIBA),MOF-Fe(DIBA)包载姜黄素/羧苄西林/MTX甲氨蝶呤/紫杉醇PTX/阿霉素DOX/顺铂CDDP/CPT喜树碱等药物
Epoll 反应堆模型核心原理及代码讲解