Touch 触摸
struct in UnityEngine
/
Implemented in:UnityEngine.InputLegacyModule
UnityEngine 中的结构体
/
实现于:UnityEngine.InputLegacyModule
Description 描述
Structure describing the status of a finger touching the screen.
Devices can track a number of different pieces of data about a touch on a touchscreen, including its phase (ie, whether it has just started, ended or moved), its position and whether the
touch was a single contact or several taps. Furthermore, the continuity of a touch between frame updates can be
detected by the device, so a consistent ID number can be reported across frames and used to determine how a
particular finger is moving.
The Touch struct is used by Unity to store data relating to a single
touch instance and is returned by the Input.GetTouch function. Fresh calls to
GetTouch will be required on each frame update to obtain the latest touch information from the device but the fingerId property can be used to identify the same touch between frames.
See
Also: Input.GetTouch, TouchPhase enum.
描述手指触摸屏幕状态的结构。
设备可以跟踪有关触摸屏上触摸的许多不同数据,包括其phase(即,它是否刚刚开始,结束或移动),其位置以及触摸是单次接触还是几次轻击。此外,设备可以检测到帧更新之间的触摸连续性,因此可以跨帧报告一致的ID号,并用于确定特定手指的移动方式。
Unity使用Touch结构存储与单个触摸实例有关的数据,并由Input.GetTouch函数返回。在每次更新框架时都需要重新调用GetTouch,以从设备获取最新的触摸信息,但是fingerId属性可用于标识框架之间的相同触摸。
另请参见:Input.GetTouch,TouchPhase枚举。
Properties 属性
| 高度角 | altitudeAngle | 弧度值为0表示触控笔与表面平行,pi / 2表示其垂直。 | Value of 0 radians indicates that the stylus is parallel to the surface, pi/2 indicates that it is perpendicular. |
| 方位角 | azimuthAngle | 弧度值为0表示触控笔沿设备的x轴指向。 | Value of 0 radians indicates that the stylus is pointed along the x-axis of the device. |
| 增量位置 | deltaPosition | 触摸位置的改变量(自上次更改以来的位置变化量。) | The position delta since last change. |
| 增量时间 | deltaTime | 距离上次触摸数据变化的时间间隔 (自上次记录的触摸值更改以来经过的时间。) | Amount of time that has passed since the last recorded change in Touch values. |
| 手指索引 | fingerId | 触摸的唯一索引ID。 | The unique index for the touch. |
| 最大可能压力 | maximumPossiblePressure | 平台的最大可能压力值。如果Input.touchPressureSupported返回false,则此属性的值将始终为1.0f。 | The maximum possible pressure value for a platform. If Input.touchPressureSupported returns false, the value of this property will always be 1.0f. |
| 阶段(状态) | phase | 描述触摸的阶段。 | Describes the phase of the touch. |
| 位置 | position | 触摸的位置(以像素坐标表示)。 | The position of the touch in pixel coordinates. |
| 压力 | pressure | 当前施加到触摸的压力量。1.0f被认为是平均触摸的压力。如果Input.touchPressureSupported返回false,则此属性的值将始终为1.0f。 | The current amount of pressure being applied to a touch. 1.0f is considered to be the pressure of an average touch. If Input.touchPressureSupported returns false, the value of this property will always be 1.0f. |
| 半径 | radius | 触摸半径的估计值。添加radiusVariance可获得最大的触摸大小,减去radiusVariance可获得最小的触摸大小。 | An estimated value of the radius of a touch. Add radiusVariance to get the maximum touch size, subtract it to get the minimum touch size. |
| 半径方差 | radiusVariance | 此值确定触摸半径的精度。将此值添加到半径以获取最大的触摸大小,将其减去以获取最小的触摸大小。 | This value determines the accuracy of the touch radius. Add this value to the radius to get the maximum touch size, subtract it to get the minimum touch size. |
| 原始位置 | rawPosition | 用于触摸的原始位置。(Vector2) | The raw position used for the touch. |
| 点击数 | tapCount | 单击计数 | Number of taps. |
| 类型 | type | 指示触摸是直接、间接(或远程)或触控笔类型的值。(TouchType 枚举) | A value that indicates whether a touch was of Direct, Indirect (or remote), or Stylus type. |