Options
All
  • Public
  • Public/Protected
  • All
Menu

Class used to manage all inputs for the scene.

Hierarchy

  • InputManager

Index

Constructors

  • Creates a new InputManager

    Parameters

    • Optional scene: Scene

      defines the hosting scene

    Returns InputManager

Properties

DoubleClickDelay: number

Time in milliseconds with two consecutive clicks will be considered as a double click

DragMovementThreshold: number

The distance in pixel that you have to move to prevent some events

ExclusiveDoubleClickMode: boolean

If you need to check double click without raising a single click at first click, enable this flag

LongPressDelay: number

Time in milliseconds to wait to raise long press events if button is still pressed

Accessors

  • Gets the mesh that is currently under the pointer

    Returns Nullable<AbstractMesh>

    Mesh that the pointer is pointer is hovering over

  • get pointerX(): number
  • set pointerX(value: number): void
  • Gets or sets the current on-screen X position of the pointer

    Returns number

    Translated X with respect to screen

  • Gets or sets the current on-screen X position of the pointer

    Parameters

    • value: number

    Returns void

    Translated X with respect to screen

  • get pointerY(): number
  • set pointerY(value: number): void
  • Gets or sets the current on-screen Y position of the pointer

    Returns number

    Translated Y with respect to screen

  • Gets or sets the current on-screen Y position of the pointer

    Parameters

    • value: number

    Returns void

    Translated Y with respect to screen

  • Gets the pointer coordinates in 2D without any translation (ie. straight out of the pointer event)

    Returns Vector2

    Vector with X/Y values directly from pointer event

Methods

  • internal

    Parameters

    Returns void

  • _isPointerSwiping(): boolean
  • internal
    internals

    Boolean if delta for pointer exceeds drag movement threshold

    Returns boolean

  • attachControl(attachUp?: boolean, attachDown?: boolean, attachMove?: boolean, elementToAttachTo?: Nullable<HTMLElement>): void
  • Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp

    Parameters

    • Optional attachUp: boolean

      defines if you want to attach events to pointerup

    • Optional attachDown: boolean

      defines if you want to attach events to pointerdown

    • Optional attachMove: boolean

      defines if you want to attach events to pointermove

    • Optional elementToAttachTo: Nullable<HTMLElement>

      defines the target DOM element to attach to (will use the canvas by default)

    Returns void

  • detachControl(): void
  • Detaches all event handlers

    Returns void

  • When using more than one pointer (for example in XR) you can get the mesh under the specific pointer

    Parameters

    • pointerId: number

      the pointer id to use

    Returns Nullable<AbstractMesh>

    The mesh under this pointer id or null if not found

  • Gets the mesh under the pointer

    Returns Nullable<AbstractMesh>

    a Mesh or null if no mesh is under the pointer

  • isPointerCaptured(pointerId?: number): boolean
  • Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)

    Parameters

    • Optional pointerId: number

      defines the pointer id to use in a multi-touch scenario (0 by default)

    Returns boolean

    true if the pointer was captured

  • Force the value of meshUnderPointer

    Parameters

    • mesh: Nullable<AbstractMesh>

      defines the mesh to use

    • Optional pointerId: number

      optional pointer id when using more than one pointer. Defaults to 0

    • Optional pickResult: Nullable<PickingInfo>

      optional pickingInfo data used to find mesh

    Returns void

  • simulatePointerDown(pickResult: PickingInfo, pointerEventInit?: PointerEventInit): void
  • Use this method to simulate a pointer down on a mesh The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay

    Parameters

    • pickResult: PickingInfo

      pickingInfo of the object wished to simulate pointer event on

    • Optional pointerEventInit: PointerEventInit

      pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)

    Returns void

  • simulatePointerMove(pickResult: PickingInfo, pointerEventInit?: PointerEventInit): void
  • Use this method to simulate a pointer move on a mesh The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay

    Parameters

    • pickResult: PickingInfo

      pickingInfo of the object wished to simulate pointer event on

    • Optional pointerEventInit: PointerEventInit

      pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)

    Returns void

  • simulatePointerUp(pickResult: PickingInfo, pointerEventInit?: PointerEventInit, doubleTap?: boolean): void
  • Use this method to simulate a pointer up on a mesh The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay

    Parameters

    • pickResult: PickingInfo

      pickingInfo of the object wished to simulate pointer event on

    • Optional pointerEventInit: PointerEventInit

      pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)

    • Optional doubleTap: boolean

      indicates that the pointer up event should be considered as part of a double click (false by default)

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Static property
  • Static method
  • Inherited constructor

Settings

Theme