Camera.ScreenPointToRay 解析
Unity官方文档:
Camera.ScreenPointToRay
public function ScreenPointToRay(position: Vector3): Ray;
Description
Returns a ray going from camera through a screen point.
Resulting ray is in world space, starting on the near plane of the camera and going through position's (x,y) pixel coordinates on the screen (position.z is ignored).
Screenspace is defined in pixels. The bottom-left of the screen is (0,0); the right-top is (pixelWidth,pixelHeight).
// Draws a line in the scene view going through a point 200 pixels
// from the lower-left corner of the screen
function Update () {
var ray : Ray = camera.ScreenPointToRay (Vector3(,,));
Debug.DrawRay (ray.origin, ray.direction * , Color.yellow);
}
解释说明:
Returns a ray going from camera through a screen point.
返回一条射线,从相机开始并且穿过一个屏幕中的点。
Resulting ray is in world space, starting on the near plane of the camera and going through position's (x,y) pixel coordinates on the screen (position.z is ignored).
返回的射线在世界坐标空间,从相机的近剪裁面开始穿过一个屏幕中的以像素为单位的点(x,y),(忽略z坐标)
Screenspace is defined in pixels. The bottom-left of the screen is (0,0); the right-top is (pixelWidth,pixelHeight).
屏幕空间是用像素定义的。左下角是(0,0)点,右上角是(pixelWidth,pixelHeight)点。
补充:
near plane 是近剪裁面的意思。
剪裁面是相机的可见范围,他就像一个被削了尖的金字塔,近剪裁面就是金字塔顶部,这也表示了相机可以看到的最近距离,远剪裁面就是金字塔的底部,表示相机可以看到的最远距离。
Camera.ScreenPointToRay 解析的更多相关文章
- Qualcomm 8X camera过程解析【转】
本文转载自:http://blog.csdn.net/gabbzang/article/details/19906687 http://www.01yun.com/mobile_development ...
- camera render texture 游戏里的监控视角
Camera里: 新建render texture并拖入到target texture里 新建材质球 拖入render texture camera里的视角会在材质球上出现 新建一个pla ...
- Unity API 解析 (陈泉宏著)
1 Application类 2 Camera类 3 GameObject类 4 HideFlags类 5 Mathf类 6 Matrix4x4类 7 Object类 8 Quaternion类 9 ...
- ScreenPointToRay - 近视口到屏幕的射线
正如题目所说,ScreenPointToRay可以计算从Camera的近视口nearClip向前发射一条射线到屏幕上的点的坐标. 函数原型为: public Ray ScreenPointToRay( ...
- Unity3D脚本中文系列教程(十三)
http://dong2008hong.blog.163.com/blog/static/469688272014032334486/ Unity3D脚本中文系列教程(十二) ◆ function G ...
- Unity3D脚本学习——运行时类
AssetBundle 类,继承自Object.AssetBundles让你通过WWW类流式加载额外的资源并在运行时实例化它们.AssetBundles通过BuildPipeline.BuildAss ...
- [Unity3D]利用Raycast实现物体的选择与操作
本文系作者原创 转载请注明出处 如果是一个2D的平面项目或者说需要在三维空间选择一个物体时(经常表现为抓取物件),我们需要用到Raycast事件 那么首先先说说什么是Raycast 按照字面上来理解的 ...
- 【Unity3D游戏开发】基础知识之Tags和Layers (三二)[转]
Tags和Layers分别表示是Unity引擎里面的标签和层,他们都是用来对GameObject进行标识的属性,Tags常用于单个GameObject,Layers常用于一组的GameObject.添 ...
- [Unity2D]Tags和Layers
Tags和Layers分别表示是Unity引擎里面的标签和层,他们都是用来对GameObject进行标识的属性,Tags常用于单个GameObject,Layers常用于一组的GameObject.添 ...
随机推荐
- jdbc批量执行SQL insert 操作
package com.file; import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayLi ...
- sina微博上看到的关于android界面设计相关的规范
图片来自:http://photo.weibo.com/5174249907/wbphotos/large/mid/3777508610941685/pid/005EaCLFjw1emcpzdgrj9 ...
- HDU 5176 The Experience of Love 带权并查集
The Experience of Love Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/O ...
- Tower Defense Game
Tower Defense Game 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 There is a tower defense game with n level ...
- PAT (Advanced Level) 1081. Rational Sum (20)
简单模拟题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> # ...
- ubuntu下mysql 开启远程连接
一.修改配置文件: vim /etc/mysql/my.cnf,找到 bind-address = 127.0.0.1 注释掉这行,如: #bind-address = 127.0.0.1 或者改为: ...
- javascript面向对象一:函数
Arguments对象 <script type="text/javascript"> /* Arguments对象: * 在Java中存在函数的重载现象. * 节省了 ...
- [iOS Animation]-CALayer 缓冲
缓冲 生活和艺术一样,最美的永远是曲线. -- 爱德华布尔沃 - 利顿 在第九章“图层时间”中,我们讨论了动画时间和CAMediaTiming协议.现在我们来看一下另一个和时间相关的机制--所谓的缓冲 ...
- 关于CH340在STM32实现一键下载电路的研究(转)
源:关于CH340在STM32实现一键下载电路的研究 在做基于STM32的多功能MP3播放器的课题时,在程序下载这部分时借鉴了正点原子开发板上的一键下载电路,采用CH340G这款芯片设计. 在画PCB ...
- Java使用POI实现数据导出excel报表
Java使用POI实现数据导出excel报表 在上篇文章中,我们简单介绍了java读取word,excel和pdf文档内容 ,但在实际开发中,我们用到最多的是把数据库中数据导出excel报表形式.不仅 ...