ARFoundation - touch point坐标点测试
ARFoundation - touch point坐标点测试
本文目的是为了看一下Android手机上touch之后,对应的点相关信息,主要包括:
- 点的屏幕坐标,以左下角为原点;
- 点的viewport坐标系下的坐标,以左下角为原点;
- 点的世界坐标系下的坐标;
屏幕坐标系和viewport坐标系,均如下所示:

代码如下:
void Update()
{
if (Input.touchCount > 0)
{
Debug.Log("TouchTest touch number is: " + Input.touchCount);
for (int i=0; i<Input.touchCount; ++i)
{
Touch touch = Input.GetTouch(i);
Debug.Log("TouchTest touch" + Convert.ToString(i) +
" screen position is: " + touch.position);
Debug.Log("TouchTest touch" + Convert.ToString(i) +
" viewport position is: " + Camera.main.ScreenToViewportPoint(touch.position));
Debug.Log("TouchTest touch" + Convert.ToString(i) +
" world position is: " + Camera.main.ScreenToWorldPoint(touch.position));
}
}
}
| 手机屏幕的位置描述 | Screen Position | Viewport Position | World Position |
|---|---|---|---|
| 中间 | (743.0, 1654.0) | (0.5, 0.5, 0.0) | (0.1, 0.0, 0.0) |
| 左上角 | (69.0, 2906.0) | (0.0, 1.0, 0.0) | (0.0, 0.0, -0.1) |
| 右上角 | (1388.0, 2960.0) | (1.0, 1.0, 0.0) | (0.0, 0.0, 0.0) |
| 右下角 | (1390.0, 190.0) | (1.0, 0.1, 0.0) | (0.0, 0.0, 0.0) |
| 左下角 | (89.0, 217.0) | (0.1, 0.1, 0.0) | (0.0, 0.0, 0.0) |
因为当前的投影方式是透视投影,所谓的转换得到的世界坐标系的位置是,相机位于世界坐标系中的位置。
ARFoundation - touch point坐标点测试的更多相关文章
- ARFoundation - 实现物体旋转, 平移,缩放
ARFoundation - 实现物体旋转, 平移,缩放 本文目的是为了确定在移动端怎样通过单指滑动实现物体的旋转,双指实现平移和缩放. 前提知识: ARFoundation - touch poin ...
- 网页在Safari快速滚动和回弹的原理: -webkit-overflow-scrolling : touch;的实现
现在很多for Mobile的H5网页内都有快速滚动和回弹的效果,看上去和原生app的效率都有得一拼. 要实现这个效果很简单,只需要加一行css代码即可: -webkit-overflow-scrol ...
- Sencha Touch快速入门(译)
翻译自:http://www.sencha.com/learn/sencha-touch-quick-start/ 1.下载Sencha Touch SDK——下载链接 2.安装Safari或Chro ...
- JS 模拟手机页面文件的下拉刷新
js 模拟手机页面文件的下拉刷新初探 老总说需要这个功能,好吧那就看看相关的东西呗 最后弄出了一个简单的下拉刷新页面的形式,还不算太复杂 查看 demo 要在仿真器下才能看到效果,比如chrome的里 ...
- Unity3d插件研究之Easytouch
但我们开发移动端的游戏时,发现使用Input.GetMouseButtonDown的方法不可用,怎么办? 虽然unity3d也有自带触屏的方法,但是使用起来代价太高,什么单击,双击这些功能都要自己封装 ...
- [python] 安装numpy+scipy+matlotlib+scikit-learn及问题解决
这篇文章主要讲述Python如何安装Numpy.Scipy.Matlotlib.Scikit-learn等库的过程及遇到的问题解决方法.最近安装这个真是一把泪啊,各种不兼容问题和报错,希望文章对你有所 ...
- [转]Linux软连接和硬链接
1.Linux链接概念 Linux链接分两种,一种被称为硬链接(Hard Link),另一种被称为符号链接(Symbolic Link).默认情况下,ln命令产生硬链接. [硬连接]硬连接指通过索引节 ...
- 一个demo让你彻底理解Android触摸事件的并发
注:本文涉及的demo的地址:https://github.com/absfree/TouchDispatch 1. 触摸动作及事件序列 (1)触摸事件的动作 触摸动作一共有三种:ACTION_DOW ...
- Android Studio中怎么使用DDMS工具?
随着android studio的广泛使用,开发人员对相关工具的使用需求更加凸显.昨天在一个android studio教程网站上,看到一篇有关DDMS工具使用的相关知识,感觉很不错,分享给大家,一起 ...
随机推荐
- sentry can not delete release bug
sentry can not delete release bug bug $ ./node_modules/@sentry/cli/bin/sentry-cli releases list $ ./ ...
- React tutorial
https://www.algolia.com Build Unique Search ExperiencesHosted Search API that delivers instant and r ...
- Sass && SCSS && Less
1 1 1 Sass && SCSS && Less 在线SCSS编辑工具: http://www.sassmeister.com/ Sass v3.4.21 1 tu ...
- vue & npm & components & plugins
vue & npm & components & plugins how to publish an vue ui component to npm? https://www. ...
- React Hooks +React Context vs Redux
React Hooks +React Context vs Redux https://blog.logrocket.com/use-hooks-and-context-not-react-and-r ...
- 3D 室内装修线设计软件
3D 室内装修线设计软件 WebGL & canvas https://threejs.org/ xgqfrms 2012-2020 www.cnblogs.com 发布文章使用:只允许注册用 ...
- GeoJSON feature & Mapbox segments
GeoJSON feature & Mapbox segments custom JSON format ??? { "rows": [], "props&quo ...
- Renice INC:不同颜色的酒帽所代表的意义
酒帽就是酒瓶上方的热缩胶帽/锡帽/蜡封,也就是开瓶前要割掉的那一层保护物,所有的法国酒在酒帽上,都会有一个圆形贴纸,除了有不同颜色外,上面还有一串号码,有可能很多人在喝酒时都不会对这个酒帽有更多的在意 ...
- m1款MacBook Air 使用3个月总结及原生运行于apple架构软件推荐
前言 我之前一直是一个坚定的Windows/Android党,大学的时候用过几台iPhone,感觉也就那样.这次m1版本的Mac一发布我直接又转回apple阵营了,11月份的时候官网订了一台m1 版本 ...
- java基础第11期——Stream流、方法引用、junit单元测试
1.Stream流 Stream流与io流是不同的东西,用于解决集合类库已有的弊端, 1.1 获取Stream流: Collection集合的Stream方法,注意Map集合要经过转化 default ...