用于描述触摸屏幕的手指状态的结构。
设备可以跟踪很多关于触摸屏上的触摸操作的不同数据段,包括其 /phase/(即触摸是刚开始、已结束还是移动)、其位置以及触摸是一次接触还是多次点击。此外,设备还可以检查帧更新之间的触摸的连续性,因此可以跨帧报告一致的 ID 号并用它来确定特定手指的移动方式。
Unity 使用 Touch 结构存储与单次接触相关的数据,此结构由 Input.GetTouch 函数返回。每次帧更新都需要刷新 GetTouch 调用,以便从设备获取最新触摸信息,但可以使用 fingerId 属性标识帧之间的相同触摸操作。
另请参阅:Input.GetTouch、TouchPhase 枚举。
altitudeAngle | 0 弧度值指示触笔平行于表面,pi/2 指示垂直。 |
azimuthAngle | 0 弧度值指示触笔指向沿着设备 X 轴方向。 |
deltaPosition | 自上次像素坐标更改以来的位置增量。 |
deltaTime | 自记录的 Touch 值上次更改以来经过的时间。 |
fingerId | 触摸的唯一索引。 |
maximumPossiblePressure | 平台的最大可能压力值。如果 Input.touchPressureSupported 返回 false,此属性的值将始终为 1.0f。 |
phase | 描述触摸阶段。 |
position | 触摸在屏幕空间中的位置(像素坐标)。 |
pressure | 当前应用于触摸的压力大小。1.0f 被视为平均触摸压力。如果 Input.touchPressureSupported 返回 false,此属性的值将始终为 1.0f。 |
radius | 触摸半径的估计值。加上 radiusVariance 可获得最大触摸大小,减去它可获得最小触摸大小。 |
radiusVariance | 此值确定触摸半径的精度。半径加上此值可获得最大触摸大小,减去它可获得最小触摸大小。 |
rawPosition | 触摸触点在屏幕空间中的第一个位置(像素坐标)。 |
tapCount | 点击次数。 |
type | 用于指示触摸是 Direct、Indirect(或远程)还是 Stylus 类型的值。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.