Skip to content

Touch

The Touch class is used to store information about the state of a finger touching the screen.

You can obtain a Touch object in the following way:

typescript
OnUpdate(): void {

    if (Input.touchCount > 0) {
           
        let touch = Input.GetTouchByID(007);
        
    }
}

成员变量

Touch.phase : TouchPhase
(Read Only) The current state of the touch event.
Touch.tapCount : number
(Read Only) The number of times the finger touches the screen.
Touch.fingerID : number
(Read Only) The unique identifier of the finger touch.
Touch.deltaPosition : Vector2
(Read Only) The position increment since the last pixel coordinate change.
Touch.rawPosition : Vector2
(Read Only) The raw screen coordinates of the touch position.
Touch.position : Vector2
(Read Only) The current position of the touch point relative to the screen.