当前位置:网站首页>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;
}
}
```
边栏推荐
- 【并行与分布式系统】Cache学习
- 3P5 Industrial Engineering Lecture 1-2: Method of Study
- Closing method of SQL injection
- Large screen - full screen, exit full screen
- 深度学习基础篇【4】从0开始搭建EasyOCR并进行简单文字识别
- UI interaction
- Why is the trend chart of precious metal silver strong?
- GCC C内联汇编
- Switch case uses enumeration classes to compare
- 关于Set集合类你都知道什么?来自《卷Ⅰ》的灵魂提问
猜你喜欢

Learning C language from scratch day 040
![[3.delphi common components] 7 timer](/img/3c/b983575c93d7408a64a59c931ad991.jpg)
[3.delphi common components] 7 timer

SD3.0笔记

Why is the trend chart of precious metal silver strong?

SQL | calculate sum

14:00面试,14:08就出来了 ,问的实在是太...

从测试零基础到测试架构师,这10年,他是这样让自己成才的

金属有机骨架材料Fe-MIL-53,Mg-MOF-74,Ti-KUMOF-1,Fe-MIL-100,Fe-MIL-101)负载异氟醚/甲氨蝶呤/阿霉素(DOX)/紫杉醇/布洛芬/喜树碱

软件测试面试复盘:技术面没有难倒我,hr面却是一把挂

Epoll 原理及应用 && ET模式与LT模式
随机推荐
2022 safety officer-b certificate examination question bank and answers
Customized redistemplate in redis
Find - (sequential search)
[untitled]
What do you know about the set class? Soul questions from Volume I
Number of different paths
koa2学习笔记
The most complete format description of clang format
Oracle collects statistics
叶酸配体的金属有机骨架材料MOFs负载5-氟尿嘧啶,西达本胺,紫杉醇,阿霉素,柔红霉素,布洛芬,喜树碱,姜黄素,藤黄酸等小分子药物
889. construct binary tree according to preorder and postorder traversal
软件测试面试复盘:技术面没有难倒我,hr面却是一把挂
Infinite level classification (or menu) design
Find - (block find)
JS basic part hand exercises
How to guarantee the data quality of data warehouse?
Orcale driver
当逻辑删除遇上唯一索引,遇到的问题和解决方案?
关于Set集合类你都知道什么?来自《卷Ⅰ》的灵魂提问
421. maximum XOR value of two numbers in the array