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.添 ...
随机推荐
- 转:Visual Studio进行Web性能测试- Part II
原文作者:Ambily.raj 对于一个多用户的应用程序,性能是非常重要的.性能不仅是执行的速度,它包括负载和并发方面.Visual Studio是可以用于性能测试的工具之一.Visual Studi ...
- Fox And Names
Description Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce ...
- ural1470 UFOs
UFOs Time limit: 2.0 secondMemory limit: 64 MB Vasya is a ufologist and his duties include observing ...
- 【GO】关于GO的浅显总结
最近看了下go的入门教程,被它的强大震撼了,第一印象感觉特点主要有如下几个吧: 1. 集c,python,erlang之长,和c同属静态语言,保证效率:语法如python一样简洁,库很强大:从erla ...
- JQuery的插件开发——重点
1.给JQuery全局对象扩展一个函数方法 $.log=function(){ /* 给全局对象$扩展一个函数*/ } $.log;//调用方法 2.给JQuery普通对象扩展一个函数方法 3.使用第 ...
- How difficult is it to create a JavaScript framework?
分享来自 quora 的一篇文章 https://www.quora.com/How-difficult-is-it-to-create-a-JavaScript-framework https:// ...
- CI如何在子目录下可以设置默认控制器
CI建立大型大型的应用程序,需要创建子文件夹在application/controllers下建立文件夹app1app1目录下有多个控制器,ca.php,cb.php我希望定义app1下的默认控制器, ...
- 基于Keepalvied的Mysql主主漂移(切换)
Keepalived实现原理:Keepalived详细介绍简介 实验环境 Master1.Amoeba--IP:192.168.1.5 Master2---IP:192.168.1.10 同时安装ke ...
- (中等) POJ 3280 Cheapest Palindrome,DP。
Description Keeping track of all the cows can be a tricky task so Farmer John has installed a system ...
- (中等) POJ 2828 Buy Tickets , 逆序+线段树。
Description: Railway tickets were difficult to buy around the Lunar New Year in China, so we must ge ...