Options
All
  • Public
  • Public/Protected
  • All
Menu

Class InputManager

Class used to manage all inputs for the scene.

Hierarchy

  • InputManager

Index

Constructors

constructor

  • Creates a new InputManager

    Parameters

    • scene: Scene

      defines the hosting scene

    Returns InputManager

Properties

Static DoubleClickDelaySearch playground for DoubleClickDelay

DoubleClickDelay: number

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

Static DragMovementThresholdSearch playground for DragMovementThreshold

DragMovementThreshold: number

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

Static ExclusiveDoubleClickModeSearch playground for ExclusiveDoubleClickMode

ExclusiveDoubleClickMode: boolean

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

Static LongPressDelaySearch playground for LongPressDelay

LongPressDelay: number

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

Accessors

meshUnderPointer

  • Gets the mesh that is currently under the pointer

    Returns Nullable<AbstractMesh>

pointerX

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

    Returns number

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

    Parameters

    • value: number

    Returns any

pointerY

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

    Returns number

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

    Parameters

    • value: number

    Returns any

unTranslatedPointer

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

    Returns Vector2

Methods

attachControlSearch playground for attachControl

  • 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

detachControlSearch playground for detachControl

  • detachControl(): void
  • Detaches all event handlers

    Returns void

getMeshUnderPointerByPointerIdSearch playground for getMeshUnderPointerByPointerId

  • 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

getPointerOverMeshSearch playground for getPointerOverMesh

  • Gets the mesh under the pointer

    Returns Nullable<AbstractMesh>

    a Mesh or null if no mesh is under the pointer

isPointerCapturedSearch playground for isPointerCaptured

  • 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

setPointerOverMeshSearch playground for setPointerOverMesh

  • 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

    Returns void

simulatePointerDownSearch playground for simulatePointerDown

  • 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

simulatePointerMoveSearch playground for simulatePointerMove

  • 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

simulatePointerUpSearch playground for simulatePointerUp

  • 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