Class

SpatialInputEvent

Defines Spatial input events for Compose, representing a user's input in 3D space.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Android
public class SpatialInputEvent(
    public val source: Source,
    public val pointerType: Pointer,
    public val action: Action,
    public val timestamp: Long,
    public val hitPosition: Vector3?,
    public val origin: Vector3,
    public val direction: Vector3,
)

Defines Spatial input events for Compose, representing a user's input in 3D space. These are fired when an InteractionPolicy is attached to a Composable.

Parameters

source Type of source (e.g. hands, controller, head) that generated this event.
pointerType Type of the individual pointer (e.g. left, right or default) for this event.
timestamp Timestamp from SystemClock.uptimeMillis) time base.
hitPosition The offset of the point of interaction, in pixels, relative to the center of the Composable this input targets. This is null if an input ray no longer hits the Composable during an Action sequence.
origin The origin of the ray in the receiver's activity space, in pixels.
direction A point indicating the direction the ray is pointing, in the receiver's activity space, in pixels.
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.