選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

trackable-pointer.md 2.3KB

TrackablePointer

A trackable that represents a pointer tracked by a PointerTracker.

A pointer is an abstraction that represents an instance of user input that targets one or more coordinates on a screen. For example, each point of contact between fingers and a multitouch screen generate a pointer. Devices such as a mouse and a pen/stylus also generate pointers.

Pointers are positioned in the viewport, and their positions are given in normalized coordinates. Normalized coordinates range from -1 to +1. The center of the viewport is at (0,0). The top-right corner is at (1,1). The bottom-left corner is at (-1,-1).

Since: 0.4.0

Properties

id

pointer.id: number, read-only

A unique identifier assigned to this pointer.

phase

pointer.phase: string, read-only

The phase of the pointer. It’s one of the following strings:

  • "began": the tracking began in this frame (e.g., a finger has just touched the screen)
  • "stationary": the user did not move the pointer in this frame
  • "moved": the user moved the pointer in this frame
  • "ended": the tracking ended in this frame (e.g., a finger has just been lifted from the screen)
  • "canceled": the tracking was canceled in this frame (e.g., the screen orientation of the device has just been changed)

position

pointer.position: Vector2, read-only

The current position of the pointer, given in normalized coordinates.

initialPosition

pointer.initialPosition: Vector2, read-only

The position of the pointer when its tracking began.

deltaPosition

pointer.deltaPosition: Vector2, read-only

The difference between the position of the pointer in this and in the previous frame.

velocity

pointer.velocity: Vector2, read-only

The current velocity of the pointer, given in normalized coordinates per second. You can get the speed of motion by calculating the magnitude of this vector.

isPrimary

pointer.isPrimary: boolean, read-only

Whether or not this is the primary pointer among all pointers of this type. A typical primary pointer is that of a finger that touches the screen when no other fingers are touching it.

type

pointer.type: string, read-only

The type of device that originated this pointer. Typically "touch", "mouse" or "pen".