Class InputManager
Hierarchy
- InputManager
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Creates a new InputManager
Parameters
-
scene: Scene
defines the hosting scene
Returns InputManager
-
Properties
Static Double Click DelaySearch playground for DoubleClickDelay
Time in milliseconds with two consecutive clicks will be considered as a double click
Static Drag Movement ThresholdSearch playground for DragMovementThreshold
The distance in pixel that you have to move to prevent some events
Static Exclusive Double Click ModeSearch playground for ExclusiveDoubleClickMode
If you need to check double click without raising a single click at first click, enable this flag
Static Long Press DelaySearch playground for LongPressDelay
Time in milliseconds to wait to raise long press events if button is still pressed
Accessors
mesh Under Pointer
-
Gets the mesh that is currently under the pointer
Returns Nullable<AbstractMesh>
pointerX
-
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
-
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
-
un Translated Pointer
-
Gets the pointer coordinates in 2D without any translation (ie. straight out of the pointer event)
Returns Vector2
Methods
attach ControlSearch playground for attachControl
-
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
-
detach ControlSearch playground for detachControl
-
Detaches all event handlers
Returns void
get Mesh Under Pointer ByPointer IdSearch 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
-
get Pointer Over MeshSearch playground for getPointerOverMesh
-
Gets the mesh under the pointer
Returns Nullable<AbstractMesh>
a Mesh or null if no mesh is under the pointer
is Pointer CapturedSearch playground for isPointerCaptured
-
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
-
set Pointer Over MeshSearch 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
-
simulate Pointer DownSearch playground for simulatePointerDown
-
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
-
simulate Pointer MoveSearch playground for simulatePointerMove
-
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
-
simulate Pointer UpSearch playground for simulatePointerUp
-
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
-
Class used to manage all inputs for the scene.