public final class InputEvent


Defines input events for SceneCore.

Summary

Nested types

public static class InputEvent.Action

Specifies the action (e.g. down, up, move, etc.) of the input event.

public final class InputEvent.HitInfo

Information about the hit result of the input ray, originating from one of the InputEvent.Source, and intersecting with some Entity on the scene.

public static class InputEvent.Pointer

Specifies the pointer type (e.g. left, right or default) of the input event.

public static class InputEvent.Source

Specifies the source (e.g. hands, controller, head) of the input event.

Public constructors

InputEvent(
    int source,
    int pointerType,
    long timestamp,
    @NonNull Vector3 origin,
    @NonNull Vector3 direction,
    int action,
    @NonNull List<@NonNull InputEvent.HitInfo> hitInfoList
)

Public methods

boolean
equals(Object other)
final int

Actions similar to Android's MotionEvent for keeping track of a sequence of events on the same target, e.g., HOVER_ENTER -> HOVER_MOVE -> HOVER_EXIT, DOWN -> MOVE -> UP.

final @NonNull Vector3

A point indicating the direction the ray is pointing, in the receiver's activity space.

final @NonNull List<@NonNull InputEvent.HitInfo>

List of HitInfo for the scene entities from the same task that were hit by the input ray, if any.

final @NonNull Vector3

The origin of the ray in the receiver's activity space.

final int

Type of the individual pointer (e.g. left, right or default) for this event.

final int

Type of source (e.g. hands, controller, head) that generated this event.

final long

Timestamp from SystemClock.uptimeMillis time base.

int

Public constructors

InputEvent

Added in 1.0.0-alpha05
public InputEvent(
    int source,
    int pointerType,
    long timestamp,
    @NonNull Vector3 origin,
    @NonNull Vector3 direction,
    int action,
    @NonNull List<@NonNull InputEvent.HitInfo> hitInfoList
)
Parameters
int source

Type of source (e.g. hands, controller, head) that generated this event.

int pointerType

Type of the individual pointer (e.g. left, right or default) for this event.

long timestamp

Timestamp from SystemClock.uptimeMillis time base.

@NonNull Vector3 origin

The origin of the ray in the receiver's activity space.

@NonNull Vector3 direction

A point indicating the direction the ray is pointing, in the receiver's activity space.

int action

Actions similar to Android's MotionEvent for keeping track of a sequence of events on the same target, e.g., HOVER_ENTER -> HOVER_MOVE -> HOVER_EXIT, DOWN -> MOVE -> UP.

@NonNull List<@NonNull InputEvent.HitInfo> hitInfoList

List of HitInfo for the scene entities from the same task that were hit by the input ray, if any. The list is sorted from closest to farthest from the ray origin. Note that this first hit entity remains the same during an ongoing DOWN -> MOVE -> UP action, even if the pointer stops hitting the entity during the action.

Public methods

equals

public boolean equals(Object other)

getAction

Added in 1.0.0-alpha05
public final int getAction()

Actions similar to Android's MotionEvent for keeping track of a sequence of events on the same target, e.g., HOVER_ENTER -> HOVER_MOVE -> HOVER_EXIT, DOWN -> MOVE -> UP.

getDirection

Added in 1.0.0-alpha05
public final @NonNull Vector3 getDirection()

A point indicating the direction the ray is pointing, in the receiver's activity space.

getHitInfoList

Added in 1.0.0-alpha05
public final @NonNull List<@NonNull InputEvent.HitInfogetHitInfoList()

List of HitInfo for the scene entities from the same task that were hit by the input ray, if any. The list is sorted from closest to farthest from the ray origin. Note that this first hit entity remains the same during an ongoing DOWN -> MOVE -> UP action, even if the pointer stops hitting the entity during the action.

getOrigin

Added in 1.0.0-alpha05
public final @NonNull Vector3 getOrigin()

The origin of the ray in the receiver's activity space.

getPointerType

Added in 1.0.0-alpha05
public final int getPointerType()

Type of the individual pointer (e.g. left, right or default) for this event.

getSource

Added in 1.0.0-alpha05
public final int getSource()

Type of source (e.g. hands, controller, head) that generated this event.

getTimestamp

Added in 1.0.0-alpha05
public final long getTimestamp()

Timestamp from SystemClock.uptimeMillis time base.

hashCode

public int hashCode()