The Needle Engine Pointer Event is a custom event that extends the PointerEvent. It holds additional information like the device index, the origin of the event, the mode of the event (e.g. screen or spatial), the ray in world space, the space of the device, and more.

Hierarchy

Constructors

Properties

clientZ?: number

Spatial input data

deviceIndex: number

the device index: mouse and touch are always 0, otherwise e.g. index of the connected Gamepad or XRController

intersections: NEPointerEventIntersection[] = ...

intersections that were generated from this event (or are associated with this event in any way)

isClick: boolean = false

true if this event is a click

isDoubleClick: boolean = false

true if this event is a double click

metadata: {} = {}

metadata can be used to associate additional information with the event

mode: XRTargetRayMode

Is the pointer event created via a touch on screen or a spatial device like a XR controller or hand tracking?

The origin of the event contains a reference to the creator of this event.
This can be the Needle Engine input system or e.g. a XR controller.
Implement onPointerHits to receive the intersections of this event.

source: null | Event

the browser event that triggered this event (if any)

The device space (this object is not necessarily rendered in the scene but you can access or copy the matrix)
E.g. you can access the input world space source position with space.worldPosition or world direction with space.worldForward

Accessors

  • get hasRay(): boolean
  • Returns boolean

    true if this event has a ray. If you access the ray property a ray will automatically created

  • get immediatePropagationStopped(): boolean
  • Returns boolean

  • get isSpatial(): boolean
  • Returns true if the input was emitted in 3D space (and not by e.g. clicking on a 2D screen). You can use mode if you need more information about the input source

    Returns boolean

  • get pointerId(): number
  • Unique identifier for this input: a combination of the deviceIndex + button to uniquely identify the exact input (e.g. LeftController:Button0 = 0, RightController:Button1 = 11)

    Returns number

  • get pointerType(): PointerTypeNames
  • What type of input created this event: touch, mouse, xr controller, xr hand tracking...

    Returns PointerTypeNames

  • get propagationStopped(): boolean
  • Returns boolean

  • get ray(): Ray
  • A ray in worldspace for the event.
    If the ray is undefined you can also use space.worldForward and space.worldPosition

    Returns Ray

  • set ray(value): void
  • Parameters

    • value: Ray

    Returns void

  • get used(): boolean
  • Returns boolean

    true if the event is marked to be used (when use() has been called). Default: false

Methods

  • Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.

    MDN Reference

    Returns void

  • When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.

    MDN Reference

    Returns void

  • Call to mark an event to be used

    Returns void