Description
Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts
TheController
API provides facilities to interact with computer and controller hardware.
Facilities
Properties
Get Controller
property trees.
Mappings
Create and enable or disable Controller
mappings.
Input, Hardware, and Action Reflection
Information on the devices and actions available.
- findAction
- findDevice
- getActionNames
- getAllActions
- getAvailableInputs
- getDeviceName
- getDeviceNames
- getRunningInputDevices
Input, Hardware, and Action Signals
Notifications of device and action events.
Mouse, Keyboard, and Touch Signals
Notifications of mouse, keyboard, and touch events.
- keyPressEvent
- keyReleaseEvent
- mouseDoublePressEvent
- mouseMoveEvent
- mousePressEvent
- mouseReleaseEvent
- touchBeginEvent
- touchEndEvent
- touchUpdateEvent
- wheelEvent
Control Capturing
Disable and enable the processing of mouse and touch events.
- captureMouseEvents
- captureWheelEvents
- captureTouchEvents
- releaseMouseEvents
- releaseWheelEvents
- releaseTouchEvents
Action Capturing
Disable and enable controller actions.
- captureActionEvents
- captureKeyEvents
- captureJoystick
- captureEntityClickEvents
- releaseActionEvents
- releaseKeyEvents
- releaseJoystick
- releaseEntityClickEvents
Controller and Action Values
Get the current value of controller outputs and actions.
Haptics
Trigger haptic pulses.
- triggerHapticPulse
- triggerHapticPulseOnDevice
- triggerShortHapticPulse
- triggerShortHapticPulseOnDevice
Display Information
Get information on the display.
Virtual Game Pad
Use the virtual game pad which is available on some devices.
Input Recordings
Create and play input recordings.
- startInputRecording
- stopInputRecording
- saveInputRecording
- getInputRecorderSaveDirectory
- loadInputRecording
- startInputPlayback
- stopInputPlayback
Entity Methods
The default scripts implement hand controller actions that use Entities.callEntityMethod to call entity script methods, if present, in the entity being interacted with.
Method Name | Description | Example |
---|---|---|
startFarTrigger continueFarTrigger stopFarTrigger |
These methods are called when a user is more than 0.3m away from the entity, the entity is triggerable, and the user starts, continues, or stops squeezing the trigger. | A light switch that can be toggled on and off from a distance. |
startNearTrigger continueNearTrigger stopNearTrigger |
These methods are called when a user is less than 0.3m away from the entity, the entity is triggerable, and the user starts, continues, or stops squeezing the trigger. | A doorbell that can be rung when a user is near. |
startDistanceGrab continueDistanceGrab |
These methods are called when a user is more than 0.3m away from the entity, the entity is either cloneable, or grabbable and not locked, and the user starts or continues to squeeze the trigger. | A comet that emits icy particle trails when a user is dragging it through the sky. |
startNearGrab continueNearGrab |
These methods are called when a user is less than 0.3m away from the entity, the entity is either cloneable, or grabbable and not locked, and the user starts or continues to squeeze the trigger. | A ball that glows when it's being held close. |
releaseGrab |
This method is called when a user releases the trigger when having been either distance or near grabbing an entity. | Turn off the ball glow or comet trail with the user finishes grabbing it. |
startEquip continueEquip releaseEquip |
These methods are called when a user starts, continues, or stops equipping an entity. | A glass that stays in the user's hand after the trigger is clicked. |
All the entity methods are called with the following two arguments:
- The entity ID.
- A string,
"hand,userID"
— where "hand" is"left"
or"right"
, and "userID" is the user's MyAvatar.sessionUUID.
Properties
Name | Type | Summary |
---|---|---|
Actions | Controller.Actions |
Predefined actions on Interface and the user's avatar. These can be used as end
points in a RouteObject mapping. A synonym for Default mappings are provided from the |
Hardware | Controller.Hardware |
Standard and hardware-specific controller and computer outputs, plus predefined
actions on Interface and the user's avatar. Getting this property is computationally expensive, so it's best to cache it
instead of calling on every update.
The outputs can be mapped to |
Standard | Controller.Standard |
Standard controller outputs that can be mapped to Each hardware device has a mapping from its outputs to |
Methods
Name | Return Value | Summary |
---|---|---|
captureActionEvents
|
None |
Disables translating and rotating the user's avatar in response to keyboard and controller controls. |
captureEntityClickEvents
|
None |
Disables Entities.mousePressOnEntity and Entities.mouseDoublePressOnEntity events on entities. |
captureJoystick
|
None |
Disables default Interface actions for a joystick. Deprecated: This function is deprecated and will be removed. It no longer has any effect. |
captureKeyEvents
|
None |
Disables default Interface actions for a particular key event. |
captureMouseEvents
|
None |
Disables processing of mouse "move", "press", "double-press", and "release" events into Controller.Hardware.Keyboard outputs. |
captureTouchEvents
|
None |
Disables processing of touch "begin", "update", and "end" events into Controller.Hardware.Keyboard, Controller.Hardware.Touchscreen, and Controller.Hardware.TouchscreenVirtualPad outputs. |
captureWheelEvents
|
None |
Disables processing of mouse wheel rotation events into Controller.Hardware.Keyboard outputs. |
disableMapping
|
None |
Disables a controller mapping. When disabled, the routes in the mapping have no effect. |
enableMapping
|
None |
Enables or disables a controller mapping. When enabled, the routes in the mapping have effect. |
findAction
|
number |
Finds the ID of an action from its name. |
findDevice
|
number |
Finds the ID of a specific controller from its device name. |
getActionNames
|
Array.<string> |
Gets the names of all actions available as properties of Controller.Actions. |
getActionValue
|
number |
Gets the current value of an action. |
getActions
|
Controller.Actions |
Gets the Controller.Actions property tree. Calling this function is the same as using the Controller
property, |
getAxisValue
|
number |
Gets the value of a controller axis output. Note: Also gets the value of a controller button output. |
getDeviceName
|
string |
Finds the name of a particular controller from its device ID. |
getDeviceNames
|
Array.<string> |
Gets the names of all currently available controller devices plus "Actions", "Application", and "Standard". |
getHardware
|
Controller.Hardware |
Gets the Controller.Hardware property tree. Calling this function is the same as using the Controller
property, |
getInputRecorderSaveDirectory
|
string |
Gets the directory in which input recordings are saved. |
getPoseValue
|
Pose |
Gets the value of a controller pose output. |
getRecommendedHUDRect
|
Rect |
Gets the recommended area to position UI on the HUD surface if in HMD mode or Interface's window interior if in desktop mode. |
getRunningInputDevices
|
Array.<string> |
Gets the names of all the active and running (enabled) input devices. |
getStandard
|
Controller.Standard |
Gets the Controller.Standard property tree. Calling this function is the same as using the Controller
property, |
getValue
|
number |
Gets the value of a controller button or axis output. Note: Also gets the value of a controller axis output. |
getViewportDimensions
|
Vec2 |
Gets the dimensions of the Interface window's interior if in desktop mode or the HUD surface if in HMD mode. |
loadInputRecording
|
None |
Loads an input recording, ready for play back. |
loadMapping
|
MappingObject |
Creates a new controller mapping from a MappingJSON JSON file at a URL. Use enableMapping to enable the mapping for it to take effect. Warning: This function is not yet implemented; it doesn't load a mapping and just returns
|
newMapping
|
MappingObject |
Creates a new controller mapping. Routes can then be added to the mapping using MappingObject methods and
routed to |
parseMapping
|
MappingObject |
Creates a new controller mapping from a MappingJSON string. Use enableMapping to enable the mapping for it to take effect. |
releaseActionEvents
|
None |
Enables translating and rotating the user's avatar in response to keyboard and controller controls that were disabled using captureActionEvents. |
releaseEntityClickEvents
|
None |
Re-enables Entities.mousePressOnEntity and Entities.mouseDoublePressOnEntity events on entities that were disabled using captureEntityClickEvents. |
releaseJoystick
|
None |
Re-enables default Interface actions for a joystick that has been disabled using captureJoystick. Deprecated: This function is deprecated and will be removed. It no longer has any effect. |
releaseKeyEvents
|
None |
Re-enables default Interface actions for a particular key event that has been disabled using captureKeyEvents. |
releaseMouseEvents
|
None |
Enables processing of mouse "move", "press", "double-press", and "release" events into Controller.Hardware.Keyboard outputs that were disabled using captureMouseEvents. |
releaseTouchEvents
|
None |
Enables processing of touch "begin", "update", and "end" events into Controller.Hardware.Keyboard, Controller.Hardware.Touchscreen, and Controller.Hardware.TouchscreenVirtualPad outputs that were disabled using captureTouchEvents. |
releaseWheelEvents
|
None |
Enables processing of mouse wheel rotation events into Controller.Hardware.Keyboard outputs that wer disabled using captureWheelEvents. |
saveInputRecording
|
None |
Saves the current recording to a file. The current recording may have been recorded by startInputRecording and stopInputRecording, or loaded by loadInputRecording. It is saved in the directory returned by getInputRecorderSaveDirectory. |
setVPadEnabled
|
None |
Enables or disables the virtual game pad that is displayed on certain devices (e.g., Android). |
setVPadExtraBottomMargin
|
None |
Sets the amount of extra margin between the virtual game pad that is displayed on certain devices (e.g., Android) and the bottom of the display. |
setVPadHidden
|
None |
Shows or hides the virtual game pad that is displayed on certain devices (e.g., Android). |
startInputPlayback
|
None |
Plays back the current recording from the beginning. The current recording may have been recorded by startInputRecording and stopInputRecording, or loaded by loadInputRecording. Playback repeats in a loop until stopInputPlayback is called. |
startInputRecording
|
None |
Starts making a recording of currently active controllers. |
stopInputPlayback
|
None |
Stops play back of a recording started by startInputPlayback. |
stopInputRecording
|
None |
Stops making a recording started by startInputRecording. |
triggerHapticPulse
|
None |
Triggers a haptic pulse on connected and enabled devices that have the capability. |
triggerHapticPulseOnDevice
|
None |
Triggers a haptic pulse on a particular device if connected and enabled and it has the capability. |
triggerShortHapticPulse
|
None |
Triggers a 250ms haptic pulse on connected and enabled devices that have the capability. |
triggerShortHapticPulseOnDevice
|
None |
Triggers a 250ms haptic pulse on a particular device if connected and enabled and it has the capability. |
updateRunningInputDevices
|
None |
Deprecated: This function is deprecated and will be removed. |
Signals
Name | Summary |
---|---|
actionEvent
|
Triggered when an action occurs. |
hardwareChanged
|
Triggered when a device is registered or unregistered by a plugin. Not all plugins generate
|
inputDeviceRunningChanged
|
Triggered when an input device starts or stops being active and running (enabled). For example, enabling or disabling the LeapMotion in Settings > Controls > Calibration will trigger this signal. |
inputEvent
|
Triggered when there is a new controller input event. |
keyPressEvent
|
Triggered when a keyboard key is pressed. |
keyReleaseEvent
|
Triggered when a keyboard key is released from being pressed. |
mouseDoublePressEvent
|
Triggered when a mouse button is double-pressed. |
mouseMoveEvent
|
Triggered when the mouse moves. |
mousePressEvent
|
Triggered when a mouse button is pressed. |
mouseReleaseEvent
|
Triggered when a mouse button is released from being pressed. |
touchBeginEvent
|
Triggered when a touch event starts in the Interface window on a touch-enabled display or device. |
touchEndEvent
|
Triggered when a touch event ends in the Interface window on a touch-enabled display or device. |
touchUpdateEvent
|
Triggered when a touch event update occurs in the Interface window on a touch-enabled display or device. |
wheelEvent
|
Triggered when the mouse wheel is rotated. |
Type Definitions
Actions Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The These actions can be used as end points in the routes of a MappingObject. The data item routed to each action is either a number or a Pose.
|
Hand Type: number |
||||||||
---|---|---|---|---|---|---|---|---|
Some controller actions may be associated with one or both hands:
|
Hardware Type: object |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The The outputs can be mapped to actions or functions in a RouteObject mapping. Additionally, hardware-specific controller outputs can be mapped to standard controller outputs. Controllers typically implement a subset of the Controller.Standard controls, plus they may implement some extras. Some common controllers are included in the table. You can see the outputs provided by these and others by viewing their MappingJSON files at https://github.com/highfidelity/hifi/tree/master/interface/resources/controllers.
Example
|
Hardware-Application Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The These states can be mapped to actions or functions or
|
Hardware-Keyboard Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The These events can be mapped to actions or functions or
|
Hardware-OculusTouch Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The These outputs can be mapped to actions or functions or
|
Hardware-Vive Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The These outputs can be mapped to actions or functions or
|
MappingJSON Type: object |
|||||||||
---|---|---|---|---|---|---|---|---|---|
A MappingObject can be specified in JSON format. A simple example is provided below. Full examples — the default mappings provided in Interface — can be found at https://github.com/highfidelity/hifi/tree/master/interface/resources/controllers. Properties
Example
|
MappingJSONAxis Type: object |
||||||
---|---|---|---|---|---|---|
An axis pair in a Controller.MappingJSONRoute. Properties
Example
|
MappingJSONFilter Type: object |
||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A filter in a Controller.MappingJSONRoute. Properties
Example
|
MappingJSONRoute Type: object |
||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A route in a Controller.MappingJSON. Properties
|
Standard Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The These outputs can be mapped to actions or functions in a RouteObject mapping. The data value provided by each
control is either a number or a Pose. Numbers are typically normalized to Each hardware device has a mapping from its outputs to a subset of
|
Method Details
(static) captureActionEvents( ) |
---|
Disables translating and rotating the user's avatar in response to keyboard and controller controls. Example
|
(static) captureEntityClickEvents( ) |
---|
Disables Entities.mousePressOnEntity and Entities.mouseDoublePressOnEntity events on entities. Example
|
(static) captureJoystick( joystickID ) | ||||||
---|---|---|---|---|---|---|
Disables default Interface actions for a joystick. Deprecated: This function is deprecated and will be removed. It no longer has any effect. Parameters
|
(static) captureKeyEvents( event ) | ||||||
---|---|---|---|---|---|---|
Disables default Interface actions for a particular key event. Parameters
Example
|
(static) captureMouseEvents( ) |
---|
Disables processing of mouse "move", "press", "double-press", and "release" events into Controller.Hardware.Keyboard outputs. Example
|
(static) captureTouchEvents( ) |
---|
Disables processing of touch "begin", "update", and "end" events into Controller.Hardware.Keyboard, Controller.Hardware.Touchscreen, and Controller.Hardware.TouchscreenVirtualPad outputs. |
(static) captureWheelEvents( ) |
---|
Disables processing of mouse wheel rotation events into Controller.Hardware.Keyboard outputs. |
(static) disableMapping( mappingName ) | ||||||
---|---|---|---|---|---|---|
Disables a controller mapping. When disabled, the routes in the mapping have no effect. Parameters
|
(static) enableMapping( mappingName, enableopt ) | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Enables or disables a controller mapping. When enabled, the routes in the mapping have effect. Parameters
|
(static) findAction( actionName ) → {number}
Returns: The integer ID of the action if found, otherwise 4095 . Note that this value is not
the same as the value of the relevant Controller.Actions property.
|
||||||
---|---|---|---|---|---|---|
Finds the ID of an action from its name. Parameters
Example
|
(static) findDevice( deviceName ) → {number}
Returns: The integer ID of the device if available, otherwise 65535 .
|
||||||
---|---|---|---|---|---|---|
Finds the ID of a specific controller from its device name. Parameters
Example
|
(static) getActionNames( ) → {Array.<string>}
Returns: An array of action names. |
---|
Gets the names of all actions available as properties of Controller.Actions. Example
|
(static) getActionValue( actionID ) → {number}
Returns: The current value of the action. |
||||||
---|---|---|---|---|---|---|
Gets the current value of an action. Parameters
Example
|
(static) getActions( ) → {Controller.Actions}
Returns: The Controller.Actions property tree. |
---|
Gets the Controller.Actions property tree. Calling this function is the same as using the Controller
property, |
(static) getAxisValue( source ) → {number}
Returns: The current value of the controller item output if source is valid, otherwise
0 .
|
||||||
---|---|---|---|---|---|---|
Gets the value of a controller axis output. Note: Also gets the value of a controller button output. Parameters
|
(static) getDeviceName( deviceID ) → {string}
Returns: The name of the device if found, otherwise "unknown" .
|
||||||
---|---|---|---|---|---|---|
Finds the name of a particular controller from its device ID. Parameters
Example
|
(static) getDeviceNames( ) → {Array.<string>}
Returns: An array of device names. |
---|
Gets the names of all currently available controller devices plus "Actions", "Application", and "Standard". Example
|
(static) getHardware( ) → {Controller.Hardware}
Returns: The Controller.Hardware property tree. |
---|
Gets the Controller.Hardware property tree. Calling this function is the same as using the Controller
property, |
(static) getInputRecorderSaveDirectory( ) → {string}
Returns: The directory in which input recordings are saved. |
---|
Gets the directory in which input recordings are saved. |
(static) getPoseValue( source ) → {Pose}
Returns: The current value of the controller pose output if source is a pose output, otherwise
an invalid pose with Pose.valid == false .
|
||||||
---|---|---|---|---|---|---|
Gets the value of a controller pose output. Parameters
|
(static) getRecommendedHUDRect( ) → {Rect}
Returns: The recommended area in which to position UI. |
---|
Gets the recommended area to position UI on the HUD surface if in HMD mode or Interface's window interior if in desktop mode. |
(static) getRunningInputDevices( ) → {Array.<string>}
Returns: The list of current active and running input devices. |
---|
Gets the names of all the active and running (enabled) input devices. Example
|
(static) getStandard( ) → {Controller.Standard}
Returns: The Controller.Standard property tree. |
---|
Gets the Controller.Standard property tree. Calling this function is the same as using the Controller
property, |
(static) getValue( source ) → {number}
Returns: The current value of the controller item output if source is valid, otherwise
0 .
|
||||||
---|---|---|---|---|---|---|
Gets the value of a controller button or axis output. Note: Also gets the value of a controller axis output. Parameters
Example
|
(static) getViewportDimensions( ) → {Vec2}
Returns: The dimensions of the Interface window interior if in desktop mode or HUD surface if in HMD mode. |
---|
Gets the dimensions of the Interface window's interior if in desktop mode or the HUD surface if in HMD mode. |
(static) loadInputRecording( file ) | ||||||
---|---|---|---|---|---|---|
Loads an input recording, ready for play back. Parameters
|
(static) loadMapping( jsonURL ) → {MappingObject}
Returns: A controller mapping object. |
||||||
---|---|---|---|---|---|---|
Creates a new controller mapping from a MappingJSON JSON file at a URL. Use enableMapping to enable the mapping for it to take effect. Warning: This function is not yet implemented; it doesn't load a mapping and just returns
Parameters
|
(static) newMapping( mappingNameopt ) → {MappingObject}
Returns: A controller mapping object. |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Creates a new controller mapping. Routes can then be added to the mapping using MappingObject methods and
routed to Parameters
Example
|
(static) parseMapping( jsonString ) → {MappingObject}
Returns: A controller mapping object. |
||||||
---|---|---|---|---|---|---|
Creates a new controller mapping from a MappingJSON string. Use enableMapping to enable the mapping for it to take effect. Parameters
Example
|
(static) releaseActionEvents( ) |
---|
Enables translating and rotating the user's avatar in response to keyboard and controller controls that were disabled using captureActionEvents. |
(static) releaseEntityClickEvents( ) |
---|
Re-enables Entities.mousePressOnEntity and Entities.mouseDoublePressOnEntity events on entities that were disabled using captureEntityClickEvents. |
(static) releaseJoystick( joystickID ) | ||||||
---|---|---|---|---|---|---|
Re-enables default Interface actions for a joystick that has been disabled using captureJoystick. Deprecated: This function is deprecated and will be removed. It no longer has any effect. Parameters
|
(static) releaseKeyEvents( event ) | ||||||
---|---|---|---|---|---|---|
Re-enables default Interface actions for a particular key event that has been disabled using captureKeyEvents. Parameters
|
(static) releaseMouseEvents( ) |
---|
Enables processing of mouse "move", "press", "double-press", and "release" events into Controller.Hardware.Keyboard outputs that were disabled using captureMouseEvents. |
(static) releaseTouchEvents( ) |
---|
Enables processing of touch "begin", "update", and "end" events into Controller.Hardware.Keyboard, Controller.Hardware.Touchscreen, and Controller.Hardware.TouchscreenVirtualPad outputs that were disabled using captureTouchEvents. |
(static) releaseWheelEvents( ) |
---|
Enables processing of mouse wheel rotation events into Controller.Hardware.Keyboard outputs that wer disabled using captureWheelEvents. |
(static) saveInputRecording( ) |
---|
Saves the current recording to a file. The current recording may have been recorded by startInputRecording and stopInputRecording, or loaded by loadInputRecording. It is saved in the directory returned by getInputRecorderSaveDirectory. |
(static) setVPadEnabled( enable ) | ||||||
---|---|---|---|---|---|---|
Enables or disables the virtual game pad that is displayed on certain devices (e.g., Android). Parameters
|
(static) setVPadExtraBottomMargin( margin ) | ||||||
---|---|---|---|---|---|---|
Sets the amount of extra margin between the virtual game pad that is displayed on certain devices (e.g., Android) and the bottom of the display. Parameters
|
(static) setVPadHidden( hidden ) | ||||||
---|---|---|---|---|---|---|
Shows or hides the virtual game pad that is displayed on certain devices (e.g., Android). Parameters
|
(static) startInputPlayback( ) |
---|
Plays back the current recording from the beginning. The current recording may have been recorded by startInputRecording and stopInputRecording, or loaded by loadInputRecording. Playback repeats in a loop until stopInputPlayback is called. Example
|
(static) startInputRecording( ) |
---|
Starts making a recording of currently active controllers. Example
|
(static) stopInputPlayback( ) |
---|
Stops play back of a recording started by startInputPlayback. |
(static) stopInputRecording( ) |
---|
Stops making a recording started by startInputRecording. |
(static) triggerHapticPulse( strength, duration, indexopt ) | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Triggers a haptic pulse on connected and enabled devices that have the capability. Parameters
Example
|
(static) triggerHapticPulseOnDevice( deviceID, strength, duration, indexopt ) | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Triggers a haptic pulse on a particular device if connected and enabled and it has the capability. Parameters
Example
|
(static) triggerShortHapticPulse( strength, indexopt ) | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Triggers a 250ms haptic pulse on connected and enabled devices that have the capability. Parameters
|
(static) triggerShortHapticPulseOnDevice( deviceID, strength, indexopt ) | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Triggers a 250ms haptic pulse on a particular device if connected and enabled and it has the capability. Parameters
|
(static) updateRunningInputDevices( deviceName, isRunning, runningDevices ) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Deprecated: This function is deprecated and will be removed. Parameters
|
Signal Details
actionEvent(
actionID,
value
)
Returns: Signal |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Triggered when an action occurs. Parameters
Example
|
hardwareChanged(
)
Returns: Signal |
---|
Triggered when a device is registered or unregistered by a plugin. Not all plugins generate
|
inputDeviceRunningChanged(
deviceName,
isRunning
)
Returns: Signal |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Triggered when an input device starts or stops being active and running (enabled). For example, enabling or disabling the LeapMotion in Settings > Controls > Calibration will trigger this signal. Parameters
|
inputEvent(
action,
value
)
Returns: Signal |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Triggered when there is a new controller input event. Parameters
Example
|
keyPressEvent(
event
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when a keyboard key is pressed. Parameters
Example
|
keyReleaseEvent(
event
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when a keyboard key is released from being pressed. Parameters
|
mouseDoublePressEvent(
event
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when a mouse button is double-pressed. Parameters
|
mouseMoveEvent(
event
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the mouse moves. Parameters
Example
|
mousePressEvent(
event
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when a mouse button is pressed. Parameters
|
mouseReleaseEvent(
event
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when a mouse button is released from being pressed. Parameters
|
touchBeginEvent(
event
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when a touch event starts in the Interface window on a touch-enabled display or device. Parameters
Example
|
touchEndEvent(
event
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when a touch event ends in the Interface window on a touch-enabled display or device. Parameters
|
touchUpdateEvent(
event
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when a touch event update occurs in the Interface window on a touch-enabled display or device. Parameters
|
wheelEvent(
event
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the mouse wheel is rotated. Parameters
Example
|