diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 9a51b102dc..d4237110e7 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -688,6 +688,34 @@ private: } }; +/**jsdoc + *
The Controller.Hardware.Application
object has properties representing Interface's state. The property
+ * values are integer IDs, uniquely identifying each output. Read-only. These can be mapped to actions or functions or
+ * Controller.Standard
items in a {@link RouteObject} mapping (e.g., using the {@link RouteObject#when} method).
+ * Each data value is either 1.0
for "true" or 0.0
for "false".
Property | Type | Data | Description |
---|---|---|---|
CameraFirstPerson | number | number | The camera is in first-person mode. + * |
CameraThirdPerson | number | number | The camera is in third-person mode. + * |
CameraFSM | number | number | The camera is in full screen mirror mode. |
CameraIndependent | number | number | The camera is in independent mode. |
CameraEntity | number | number | The camera is in entity mode. |
InHMD | number | number | The user is in HMD mode. |
AdvancedMovement | number | number | Advanced movement controls are enabled. + * |
SnapTurn | number | number | Snap turn is enabled. |
Grounded | number | number | The user's avatar is on the ground. |
NavigationFocused | number | number | Not used. |
Properties
+ *Mappings
+ *Input, Hardware, and Action Reflection
+ *Input, Hardware, and Action Events
+ *Mouse, Keyboard, and Touch Events
+ *Control Capturing
+ *Action Capturing
+ *Controller and Action Values
+ *Haptics
+ *Display Information
+ *Virtual Game Pad
+ *Input Recordings
+ *Controller.Hardware.Actions
.
+ * Read-only.Controller.Hardware.Keyboard
and Controller.Standard
to
+ * actions in
+ *
+ * keyboardMouse.json and
+ *
+ * standard.json, respectively.
+ *
+ * @property {Controller.Hardware} Hardware - Standard and hardware-specific controller and computer outputs, plus predefined
+ * actions on Interface and the user's avatar. The outputs can be mapped to Actions
or functions in a
+ * {@link RouteObject} mapping. Additionally, hardware-specific controller outputs can be mapped to Standard
+ * controller outputs. Read-only.
+ *
+ * @property {Controller.Standard} Standard - Standard controller outputs that can be mapped to Actions
or
+ * functions in a {@link RouteObject} mapping. Read-only.Controller.Standard
items, specified in a JSON file.
+ * For example,
+ * leapmotion.json and
+ * vive.json.
+ */
+
/// handles scripting of input controller commands from JS
class ControllerScriptingInterface : public controller::ScriptingInterface {
Q_OBJECT
-
public:
virtual ~ControllerScriptingInterface() {}
@@ -53,40 +196,214 @@ public:
public slots:
+ /**jsdoc
+ * Disable default Interface actions for a particular key event.
+ * @function Controller.captureKeyEvents
+ * @param {KeyEvent} event - Details of the key event to be captured. The key
property must be specified. The
+ * text
property is ignored. The other properties default to false
.
+ * @example key
property must be
+ * specified. The text
property is ignored. The other properties default to false
.
+ */
virtual void releaseKeyEvents(const KeyEvent& event);
+ /**jsdoc
+ * Disable default Interface actions for a joystick.
+ * @function Controller.captureJoystick
+ * @param {number} joystickID - The integer ID of the joystick.
+ * @deprecated This function no longer has any effect.
+ */
virtual void captureJoystick(int joystickIndex);
+
+ /**jsdoc
+ * Re-enable default Interface actions for a joystick that has been disabled using
+ * {@link Controller.captureJoystick|captureJoystick}.
+ * @function Controller.releaseJoystick
+ * @param {number} joystickID - The integer ID of the joystick.
+ * @deprecated This function no longer has any effect.
+ */
virtual void releaseJoystick(int joystickIndex);
+ /**jsdoc
+ * Disable {@link Entities.mousePressOnEntity} and {@link Entities.mouseDoublePressOnEntity} events on entities.
+ * @function Controller.captureEntityClickEvents
+ * @example true
then the virtual game pad doesn't work, otherwise it does work provided
+ * that it is not hidden by {@link Controller.setVPadHidden|setVPadHidden}.
+ *
+ */
virtual void setVPadEnabled(bool enable);
+
+ /**jsdoc
+ * Shows or hides the virtual game pad that is displayed on certain devices (e.g., Android).
+ * @function Controller.setVPadHidden
+ * @param {boolean} hidden - If true
then the virtual game pad is hidden, otherwise it is shown.
+ */
virtual void setVPadHidden(bool hidden); // Call it when a window should hide it
+
+ /**jsdoc
+ * 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.
+ * @function Controller.setVPadExtraBottomMargin
+ * @param {number} margin - Integer number of pixels in the extra margin.
+ */
virtual void setVPadExtraBottomMargin(int margin);
signals:
+ /**jsdoc
+ * Triggered when a keyboard key is pressed.
+ * @function Controller.keyPressEvent
+ * @param {KeyEvent} event - Details of the key press.
+ * @returns {Signal}
+ * @example The Controller.Actions
object has properties representing predefined actions on the user's avatar and
+ * Interface. The property values are integer IDs, uniquely identifying each action. Read-only. These can be used
+ * as end points in the routes of a {@link MappingObject}. The data routed to each action is either a number or a
+ * {@link Pose}.
Property | Type | Data | Description |
---|---|---|---|
Avatar Movement | + *|||
TranslateX | number | number | Move the user's avatar in the direction of its + * x-axis, if the camera isn't in independent or mirror modes. |
TranslateY | number | number | Move the user's avatar in the direction of its + * y-axis, if the camera isn't in independent or mirror modes. |
TranslateZ | number | number | Move the user's avatar in the direction of its + * z-axis, if the camera isn't in independent or mirror modes. |
Pitch | number | number | Rotate the user's avatar head and attached camera + * about its negative x-axis (i.e., positive values pitch down), if the camera isn't in HMD, independent, or mirror + * modes. |
Yaw | number | number | Rotate the user's avatar about its y-axis, if the + * camera isn't in independent or mirror modes. |
Roll | number | number | No action. |
StepTranslateX | number | number | No action. |
StepTranslateY | number | number | No action. |
StepTranslateZ | number | number | No action. |
StepPitch | number | number | No action. |
StepYaw | number | number | Rotate the user's avatar about its y-axis in a + * step increment, if the camera isn't in independent or mirror modes. |
StepRoll | number | number | No action. |
Avatar Skeleton | + *|||
Hips | number | {@link Pose} | Set the hips pose of the user's avatar. + * |
Spine2 | number | {@link Pose} | Set the spine2 pose of the user's avatar. + * |
Head | number | {@link Pose} | Set the head pose of the user's avatar. + * |
LeftArm | number | {@link Pose} | Set the left arm pose of the user's avatar. + * |
RightArm | number | {@link Pose} | Set the right arm pose of the user's + * avatar. |
LeftHand | number | {@link Pose} | Set the left hand pose of the user's + * avatar. |
LeftHandThumb1 | number | {@link Pose} | Set the left thumb 1 finger joint + * pose of the user's avatar. |
LeftHandThumb2 | number | {@link Pose} | Set the left thumb 2 finger joint + * pose of the user's avatar. |
LeftHandThumb3 | number | {@link Pose} | Set the left thumb 3 finger joint + * pose of the user's avatar. |
LeftHandThumb4 | number | {@link Pose} | Set the left thumb 4 finger joint + * pose of the user's avatar. |
LeftHandIndex1 | number | {@link Pose} | Set the left index 1 finger joint + * pose of the user's avatar. |
LeftHandIndex2 | number | {@link Pose} | Set the left index 2 finger joint + * pose of the user's avatar. |
LeftHandIndex3 | number | {@link Pose} | Set the left index 3 finger joint + * pose of the user's avatar. |
LeftHandIndex4 | number | {@link Pose} | Set the left index 4 finger joint + * pose of the user's avatar. |
LeftHandMiddle1 | number | {@link Pose} | Set the left middle 1 finger joint + * pose of the user's avatar. |
LeftHandMiddle2 | number | {@link Pose} | Set the left middle 2 finger joint + * pose of the user's avatar. |
LeftHandMiddle3 | number | {@link Pose} | Set the left middle 3 finger joint + * pose of the user's avatar. |
LeftHandMiddle4 | number | {@link Pose} | Set the left middle 4 finger joint + * pose of the user's avatar. |
LeftHandRing1 | number | {@link Pose} | Set the left ring 1 finger joint pose + * of the user's avatar. |
LeftHandRing2 | number | {@link Pose} | Set the left ring 2 finger joint pose + * of the user's avatar. |
LeftHandRing3 | number | {@link Pose} | Set the left ring 3 finger joint pose + * of the user's avatar. |
LeftHandRing4 | number | {@link Pose} | Set the left ring 4 finger joint pose + * of the user's avatar. |
LeftHandPinky1 | number | {@link Pose} | Set the left pinky 1 finger joint + * pose of the user's avatar. |
LeftHandPinky2 | number | {@link Pose} | Set the left pinky 2 finger joint + * pose of the user's avatar. |
LeftHandPinky3 | number | {@link Pose} | Set the left pinky 3 finger joint + * pose of the user's avatar. |
LeftHandPinky4 | number | {@link Pose} | Set the left pinky 4 finger joint + * pose of the user's avatar. |
RightHand | number | {@link Pose} | Set the right hand of the user's avatar. + * |
RightHandThumb1 | number | {@link Pose} | Set the right thumb 1 finger joint + * pose of the user's avatar. |
RightHandThumb2 | number | {@link Pose} | Set the right thumb 2 finger joint + * pose of the user's avatar. |
RightHandThumb3 | number | {@link Pose} | Set the right thumb 3 finger joint + * pose of the user's avatar. |
RightHandThumb4 | number | {@link Pose} | Set the right thumb 4 finger joint + * pose of the user's avatar. |
RightHandIndex1 | number | {@link Pose} | Set the right index 1 finger joint + * pose of the user's avatar. |
RightHandIndex2 | number | {@link Pose} | Set the right index 2 finger joint + * pose of the user's avatar. |
RightHandIndex3 | number | {@link Pose} | Set the right index 3 finger joint + * pose of the user's avatar. |
RightHandIndex4 | number | {@link Pose} | Set the right index 4 finger joint + * pose of the user's avatar. |
RightHandMiddle1 | number | {@link Pose} | Set the right middle 1 finger + * joint pose of the user's avatar. |
RightHandMiddle2 | number | {@link Pose} | Set the right middle 2 finger + * joint pose of the user's avatar. |
RightHandMiddle3 | number | {@link Pose} | Set the right middle 3 finger + * joint pose of the user's avatar. |
RightHandMiddle4 | number | {@link Pose} | Set the right middle 4 finger + * joint pose of the user's avatar. |
RightHandRing1 | number | {@link Pose} | Set the right ring 1 finger joint + * pose of the user's avatar. |
RightHandRing2 | number | {@link Pose} | Set the right ring 2 finger joint + * pose of the user's avatar. |
RightHandRing3 | number | {@link Pose} | Set the right ring 3 finger joint + * pose of the user's avatar. |
RightHandRing4 | number | {@link Pose} | Set the right ring 4 finger joint + * pose of the user's avatar. |
RightHandPinky1 | number | {@link Pose} | Set the right pinky 1 finger joint + * pose of the user's avatar. |
RightHandPinky2 | number | {@link Pose} | Set the right pinky 2 finger joint + * pose of the user's avatar. |
RightHandPinky3 | number | {@link Pose} | Set the right pinky 3 finger joint + * pose of the user's avatar. |
RightHandPinky4 | number | {@link Pose} | Set the right pinky 4 finger joint + * pose of the user's avatar. |
LeftFoot | number | {@link Pose} | Set the left foot pose of the user's + * avatar. |
RightFoot | number | {@link Pose} | Set the right foot pose of the user's + * avatar. |
Application | + *|||
BoomIn | number | number | Zoom camera in from third person toward first + * person view. |
BoomOut | number | number | Zoom camera out from first person to third + * person view. |
CycleCamera | number | number | Cycle the camera view from first person, to + * third person, to full screen mirror, then back to first person and repeat. |
ContextMenu | number | number | Show / hide the tablet. |
ToggleMute | number | number | Toggle the microphone mute. |
ToggleOverlay | number | number | Toggle the display of overlays. |
Sprint | number | number | Set avatar sprint mode. |
ReticleClick | number | number | Set mouse-pressed. |
ReticleX | number | number | Move the cursor left/right in the x direction. + * |
ReticleY | number | number | move the cursor up/down in the y direction. + * |
ReticleLeft | number | number | Move the cursor left. |
ReticleRight | number | number | Move the cursor right. |
ReticleUp | number | number | Move the cursor up. |
ReticleDown | number | number | Move the cursor down. |
UiNavLateral | number | number | Generate a keyboard left or right arrow key + * event. |
UiNavVertical | number | number | Generate a keyboard up or down arrow key + * event. |
UiNavGroup | number | number | Generate a keyboard tab or back-tab key event. + * |
UiNavSelect | number | number | Generate a keyboard Enter key event. + * |
UiNavBack | number | number | Generate a keyboard Esc key event. |
LeftHandClick | number | number | Deprecated: No action. + * |
RightHandClick | number | number | Deprecated: No action. + * |
Shift | number | number | Deprecated: No action. |
PrimaryAction | number | number | Deprecated: No action. + * |
SecondaryAction | number | number | Deprecated: No action. + * |
Aliases | + *|||
Backward | number | number | Alias for TranslateZ in the
+ * positive direction. |
Forward | number | number | Alias for TranslateZ in the negative
+ * direction. |
StrafeRight | number | number | Alias for TranslateX in the
+ * positive direction. |
StrafeLeft | number | number | Alias for TranslateX in the
+ * negative direction. |
Up | number | number | Alias for TranslateY in the positive
+ * direction. |
Down | number | number | Alias for TranslateY in the negative
+ * direction. |
PitchDown | number | number | Alias for Pitch in the positive
+ * direction. |
PitchUp | number | number | Alias for Pitch in the negative
+ * direction. |
YawLeft | number | number | Alias for Yaw in the positive
+ * direction. |
YawRight | number | number | Alias for Yaw in the negative
+ * direction. |
Deprecated Aliases | + *|||
LEFT_HAND | number | {@link Pose} | Deprecated: Use
+ * LeftHand instead. |
RIGHT_HAND | number | {@link Pose} | Deprecated: Use
+ * RightHand instead. |
BOOM_IN | number | number | Deprecated: Use
+ * BoomIn instead. |
BOOM_OUT | number | number | Deprecated: Use
+ * BoomOut instead. |
CONTEXT_MENU | number | number | Deprecated: Use
+ * ContextMenu instead. |
TOGGLE_MUTE | number | number | Deprecated: Use
+ * ToggleMute instead. |
SPRINT | number | number | Deprecated: Use
+ * Sprint instead. |
LONGITUDINAL_BACKWARD | number | number | Deprecated: Use
+ * Backward instead. |
LONGITUDINAL_FORWARD | number | number | Deprecated: Use
+ * Forward instead. |
LATERAL_LEFT | number | number | Deprecated: Use
+ * StrafeLeft instead. |
LATERAL_RIGHT | number | number | Deprecated: Use
+ * StrafeRight instead. |
VERTICAL_UP | number | number | Deprecated: Use
+ * Up instead. |
VERTICAL_DOWN | number | number | Deprecated: Use
+ * Down instead. |
PITCH_DOWN | number | number | Deprecated: Use
+ * PitchDown instead. |
PITCH_UP | number | number | Deprecated: Use
+ * PitchUp instead. |
YAW_LEFT | number | number | Deprecated: Use
+ * YawLeft instead. |
YAW_RIGHT | number | number | Deprecated: Use
+ * YawRight instead. |
LEFT_HAND_CLICK | number | number | Deprecated: Use
+ * LeftHandClick instead. |
RIGHT_HAND_CLICK | number | number | Deprecated: Use
+ * RightHandClick instead. |
SHIFT | number | number | Deprecated: Use
+ * Shift instead. |
ACTION1 | number | number | Deprecated: Use
+ * PrimaryAction instead. |
ACTION2 | number | number | Deprecated: Use
+ * SecondaryAction instead. |
Deprecated Trackers | + *|||
TrackedObject00 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject01 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject02 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject03 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject04 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject05 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject06 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject07 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject08 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject09 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject10 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject11 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject12 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject13 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject14 | number | {@link Pose} | Deprecated: No + * action. |
TrackedObject15 | number | {@link Pose} | Deprecated: No + * action. |
Some controller actions may be associated with one or both hands:
+ *Value | Description |
---|---|
0 | Left hand. |
1 | Right hand. |
2 | Both hands. |
The Controller.Hardware
object has properties representing standard and hardware-specific controller and
+ * computer outputs, plus predefined actions on Interface and the user's avatar. Read-only. The outputs can be mapped
+ * to actions or functions in a {@link RouteObject} mapping. Additionally, hardware-specific controller outputs can be mapped
+ * to standard controller outputs.
+ *
+ *
Controllers typically implement a subset of the {@link 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 {@link Controller.MappingJSON|MappingJSON} files at + * + * https://github.com/highfidelity/hifi/tree/master/interface/resources/controllers.
+ * + *Property | Type | Description |
---|---|---|
Controller.Hardware.Actions | object | Synonym for {@link Controller.Actions}. |
Controller.Hardware.Application | object | Interface state outputs. See + * {@link Controller.Hardware-Application}. |
Controller.Hardware.Keyboard | object | Keyboard, mouse, and touch pad outputs. See + * {@link Controller.Hardware-Keyboard}. |
Controller.Hardware.OculusTouch | object | Oculus Rift HMD outputs. See + * {@link Controller.Hardware-OculusTouch}. |
Controller.Hardware.Vive | object | Vive HMD outputs. See + * {@link Controller.Hardware-Vive}. |
Controller.Hardware
properties.true
if the pose is valid, otherwise false
.
+ */
QScriptValue Pose::toScriptValue(QScriptEngine* engine, const Pose& pose) {
QScriptValue obj = engine->newObject();
obj.setProperty("translation", vec3toScriptValue(engine, pose.translation));
@@ -37,7 +46,6 @@ namespace controller {
obj.setProperty("velocity", vec3toScriptValue(engine, pose.velocity));
obj.setProperty("angularVelocity", vec3toScriptValue(engine, pose.angularVelocity));
obj.setProperty("valid", pose.valid);
-
return obj;
}
diff --git a/libraries/controllers/src/controllers/ScriptingInterface.h b/libraries/controllers/src/controllers/ScriptingInterface.h
index fbc87898a4..dacb0c8568 100644
--- a/libraries/controllers/src/controllers/ScriptingInterface.h
+++ b/libraries/controllers/src/controllers/ScriptingInterface.h
@@ -1,6 +1,6 @@
//
-// AbstractControllerScriptingInterface.h
-// libraries/script-engine/src
+// ScriptingInterface.h
+// libraries/controllers/src/controllers
//
// Created by Brad Hefta-Gaub on 12/17/13.
// Copyright 2013 High Fidelity, Inc.
@@ -61,6 +61,8 @@ namespace controller {
/// handles scripting of input controller commands from JS
class ScriptingInterface : public QObject, public Dependency {
Q_OBJECT
+
+ // These properties have JSDoc in ControllerScriptingInterface.h.
Q_PROPERTY(QVariantMap Hardware READ getHardware CONSTANT FINAL)
Q_PROPERTY(QVariantMap Actions READ getActions CONSTANT FINAL)
Q_PROPERTY(QVariantMap Standard READ getStandard CONSTANT FINAL)
@@ -69,42 +71,401 @@ namespace controller {
ScriptingInterface();
virtual ~ScriptingInterface() {};
+ /**jsdoc
+ * Get a list of all available actions.
+ * @function Controller.getAllActions
+ * @returns {Action[]} All available actions.
+ * @deprecated This function no longer works.
+ */
+ // FIXME: This function causes a JavaScript crash: https://highfidelity.manuscript.com/f/cases/edit/13921
Q_INVOKABLE QVector"unknown"
.
+ * @example 65535
.
+ * @example 4095
. Note that this value is not
+ * the same as the value of the relevant {@link Controller.Actions} property.
+ * @example source
is valid, otherwise
+ * 0
.
+ * @example source
is valid, otherwise
+ * 0
.
+ */
+ // TODO: getAxisValue() should use const int& parameter? Or others shouldn't?
Q_INVOKABLE float getAxisValue(int source) const;
+
+ /**jsdoc
+ * Get the value of a controller pose output.
+ * @function Controller.getPoseValue
+ * @param {number} source - The {@link Controller.Standard} or {@link Controller.Hardware} pose output.
+ * @returns {Pose} The current value of the controller pose output if source
is a pose output, otherwise
+ * an invalid pose with Pose.valid == false
.
+ * @exammple 0
corresponds to Standard
.
+ * @returns {number} The current value of the button if the parameters are valid, otherwise 0
.
+ * @deprecated This function no longer works.
+ */
+ // FIXME: This function causes a JavaScript crash: https://highfidelity.manuscript.com/f/cases/edit/14139
+ Q_INVOKABLE float getButtonValue(StandardButtonChannel source, uint16_t device = 0) const;
+
+ /**jsdoc
+ * Get the value of an axis control on a particular device.
+ * @function Controller.getAxisValue
+ * @variation 0
+ * @param {StandardAxisChannel} source - The axis to get the value of.
+ * @param {number} [device=0] - The ID of the hardware device to get the value from. The default value of
+ * 0
corresponds to Standard
.
+ * @returns {number} The current value of the axis if the parameters are valid, otherwise 0
.
+ * @deprecated This function no longer works.
+ */
+ Q_INVOKABLE float getAxisValue(StandardAxisChannel source, uint16_t device = 0) const;
+
+ /**jsdoc
+ * Get the value of an pose control on a particular device.
+ * @function Controller.getPoseValue
+ * @variation 0
+ * @param {StandardPoseChannel} source - The pose to get the value of.
+ * @param {number} [device=0] - The ID of the hardware device to get the value from. The default value of
+ * 0
corresponds to Standard
.
+ * @returns {Pose} The current value of the controller pose output if the parameters are valid, otherwise an invalid
+ * pose with Pose.valid == false
.
+ * @deprecated This function no longer works.
+ */
Q_INVOKABLE Pose getPoseValue(StandardPoseChannel source, uint16_t device = 0) const;
+ /**jsdoc
+ * Triggers a haptic pulse on connected and enabled devices that have the capability.
+ * @function Controller.triggerHapticPulse
+ * @param {number} strength - The strength of the haptic pulse, 0.0
– 1.0
.
+ * @param {number} duration - The duration of the haptic pulse, in milliseconds.
+ * @param {Controller.Hand} hand=2 - The hand or hands to trigger the haptic pulse on.
+ * @example 0.0
– 1.0
.
+ * @param {Controller.Hand} hand=2 - The hand or hands to trigger the haptic pulse on.
+ */
+ Q_INVOKABLE bool triggerShortHapticPulse(float strength, controller::Hand hand = BOTH) const;
+
+ /**jsdoc
+ * Triggers a haptic pulse on a particular device if connected and enabled and it has the capability.
+ * @function Controller.triggerHapticPulseOnDevice
+ * @param {number} deviceID - The ID of the device to trigger the haptic pulse on.
+ * @param {number} strength - The strength of the haptic pulse, 0.0
– 1.0
.
+ * @param {number} duration - The duration of the haptic pulse, in milliseconds.
+ * @param {Controller.Hand} hand=2 - The hand or hands to trigger the haptic pulse on.
+ * @example 0.0
– 1.0
.
+ * @param {Controller.Hand} hand=2 - The hand or hands to trigger the haptic pulse on.
+ */
+ Q_INVOKABLE bool triggerShortHapticPulseOnDevice(unsigned int device, float strength, controller::Hand hand = BOTH)
+ const;
+
+
+ /**jsdoc
+ * Create a new controller mapping. Routes can then be added to the mapping using {@link MappingObject} methods and
+ * routed to Standard
controls, Actions
, or script functions using {@link RouteObject}
+ * methods. The mapping can then be enabled using {@link Controller.enableMapping|enableMapping} for it to take effect.
+ * @function Controller.newMapping
+ * @param {string} mappingName=Uuid.generate() - A unique name for the mapping. If not specified a new UUID generated
+ * by {@link Uuid.generate} is used.
+ * @returns {MappingObject} A controller mapping object.
+ * @example true
then the mapping is enabled, otherwise it is disabled.
+ */
Q_INVOKABLE void enableMapping(const QString& mappingName, bool enable = true);
+
+ /**jsdoc
+ * Disable a controller mapping. When disabled, the routes in the mapping have no effect.
+ * @function Controller.disableMapping
+ * @param {string} mappingName - The name of the mapping.
+ */
Q_INVOKABLE void disableMapping(const QString& mappingName) { enableMapping(mappingName, false); }
+
+ /**jsdoc
+ * Create a new controller mapping from a {@link Controller.MappingJSON|MappingJSON} string. Use
+ * {@link Controller.enableMapping|enableMapping} to enable the mapping for it to take effect.
+ * @function Controller.parseMapping
+ * @param {string} jsonString - A JSON string of the {@link Controller.MappingJSON|MappingJSON}.
+ * @returns {MappingObject} A controller mapping object.
+ * @example null
.
+ */
Q_INVOKABLE QObject* loadMapping(const QString& jsonUrl);
+
+ /**jsdoc
+ * Get the {@link Controller.Hardware} property tree. Calling this function is the same as using the {@link Controller}
+ * property, Controller.Hardware
.
+ * @function Controller.getHardware
+ * @returns {Controller.Hardware} The {@link Controller.Hardware} property tree.
+ */
Q_INVOKABLE const QVariantMap getHardware() { return _hardware; }
- Q_INVOKABLE const QVariantMap getActions() { return _actions; }
+
+ /**jsdoc
+ * Get the {@link Controller.Actions} property tree. Calling this function is the same as using the {@link Controller}
+ * property, Controller.Actions
.
+ * @function Controller.getActions
+ * @returns {Controller.Actions} The {@link Controller.Actions} property tree.
+ */
+ Q_INVOKABLE const QVariantMap getActions() { return _actions; } //undefined
+
+ /**jsdoc
+ * Get the {@link Controller.Standard} property tree. Calling this function is the same as using the {@link Controller}
+ * property, Controller.Standard
.
+ * @function Controller.getStandard
+ * @returns {Controller.Standard} The {@link Controller.Standard} property tree.
+ */
Q_INVOKABLE const QVariantMap getStandard() { return _standard; }
+
+
+ /**jsdoc
+ * Start making a recording of currently active controllers.
+ * @function Controller.startInputRecording
+ * @example "file:///"
.
+ */
Q_INVOKABLE void loadInputRecording(const QString& file);
+
+ /**jsdoc
+ * Get the directory in which input recordings are saved.
+ * @function Controller.getInputRecorderSaveDirectory
+ * @returns {string} The directory in which input recordings are saved.
+ */
Q_INVOKABLE QString getInputRecorderSaveDirectory();
bool isMouseCaptured() const { return _mouseCaptured; }
@@ -114,21 +475,156 @@ namespace controller {
public slots:
+ /**jsdoc
+ * Disable processing of mouse "move", "press", "double-press", and "release" events into
+ * {@link Controller.Hardware|Controller.Hardware.Keyboard} outputs.
+ * @function Controller.captureMouseEvents
+ * @example hardwareChanged
events: for example connecting or disconnecting a mouse will not generate an event but
+ * connecting or disconnecting an Xbox controller will.
+ * @function Controller.hardwareChanged
+ * @returns {Signal}
+ */
void hardwareChanged();
private:
@@ -145,8 +641,6 @@ namespace controller {
std::atomicThe Controller.Standard
object has properties representing standard controller outputs. Those for physical
+ * controllers are based on the XBox controller, with aliases for PlayStation. The property values are integer IDs, uniquely
+ * identifying each output. Read-only. These can be mapped to actions or functions in a {@link RouteObject}
+ * mapping.
The data value provided by each control is either a number or a {@link Pose}. Numbers are typically normalized to
+ * 0.0
or 1.0
for button states, the range 0.0 – 1.0
for unidirectional scales,
+ * and the range -1.0 – 1.0
for bidirectional scales.
Each hardware device has a mapping from its outputs to Controller.Standard
items, specified in a JSON file.
+ * For example,
+ * leapmotion.json and
+ * vive.json.
Property | Type | Data | Description |
---|---|---|---|
Buttons | |||
A | number | number | "A" button pressed. |
B | number | number | "B" button pressed. |
X | number | number | "X" button pressed. |
Y | number | number | "Y" button pressed. |
DL | number | number | D-pad left pressed. |
DR | number | number | D-pad right pressed. |
DU | number | number | D-pad up pressed. |
DD | number | number | D-pad down pressed. |
Start | number | number | "Start" center button pressed. |
Back | number | number | "Back" center button pressed. |
LB | number | number | Left bumper button pressed. |
RB | number | number | Right bumper button pressed. |
Sticks | |||
LX | number | number | Left stick x-axis scale. |
LY | number | number | Left stick y-axis scale. |
RX | number | number | Right stick x-axis scale. |
RY | number | number | Right stick y-axis scale. |
LS | number | number | Left stick button pressed. |
RS | number | number | Right stick button pressed. |
LSTouch | number | number | Left stick is touched. |
RSTouch | number | number | Right stick is touched. |
Triggers | |||
LT | number | number | Left trigger scale. |
RT | number | number | Right trigger scale. |
LTClick | number | number | Left trigger click. |
RTClick | number | number | Right trigger click. |
LeftGrip | number | number | Left grip scale. |
RightGrip | number | number | Right grip scale. |
LeftGripTouch | number | number | Left grip is touched. |
RightGripTouch | number | number | Right grip is touched. |
Aliases, PlayStation Style Names | |||
Cross | number | number | Alias for A . |
Circle | number | number | Alias for B . |
Square | number | number | Alias for X . |
Triangle | number | number | Alias for Y . |
Left | number | number | Alias for DL . |
Right | number | number | Alias for DR . |
Up | number | number | Alias for DU . |
Down | number | number | Alias for DD . |
Select | number | number | Alias for Back . |
L1 | number | number | Alias for LB . |
R1 | number | number | Alias for RB . |
L3 | number | number | Alias for LS . |
R3 | number | number | Alias for RS . |
L2 | number | number | Alias for LT . |
R2 | number | number | Alias for RT . |
Finger Abstractions | |||
LeftPrimaryThumb | number | number | Left primary thumb button pressed. |
LeftSecondaryThumb | number | number | Left secondary thumb button pressed. + * |
RightPrimaryThumb | number | number | Right primary thumb button pressed. + * |
RightSecondaryThumb | number | number | Right secondary thumb button pressed. + * |
LeftPrimaryThumbTouch | number | number | Left thumb touching primary thumb + * button. |
LeftSecondaryThumbTouch | number | number | Left thumb touching secondary thumb + * button. |
LeftThumbUp | number | number | Left thumb not touching primary or secondary + * thumb buttons. |
RightPrimaryThumbTouch | number | number | Right thumb touching primary thumb + * button. |
RightSecondaryThumbTouch | number | number | Right thumb touching secondary thumb + * button. |
RightThumbUp | number | number | Right thumb not touching primary or secondary + * thumb buttons. |
LeftPrimaryIndex | number | number | Left primary index control pressed. + * To Do: Implement this for current controllers. |
LeftSecondaryIndex | number | number | Left secondary index control pressed. + * |
RightPrimaryIndex | number | number | Right primary index control pressed. + * To Do: Implement this for current controllers. |
RightSecondaryIndex | number | number | Right secondary index control pressed. + * |
LeftPrimaryIndexTouch | number | number | Left index finger is touching primary + * index finger control. |
LeftSecondaryIndexTouch | number | number | Left index finger is touching + * secondary index finger control. |
LeftIndexPoint | number | number | Left index finger is pointing, not touching + * primary or secondary index finger controls. |
RightPrimaryIndexTouch | number | number | Right index finger is touching primary + * index finger control. |
RightSecondaryIndexTouch | number | number | Right index finger is touching + * secondary index finger control. |
RightIndexPoint | number | number | Right index finger is pointing, not touching + * primary or secondary index finger controls. |
Avatar Skeleton | |||
Hips | number | {@link Pose} | Hips pose. |
Spine2 | number | {@link Pose} | Spine2 pose. |
Head | number | {@link Pose} | Head pose. |
LeftArm | number | {@link Pose} | Left arm pose. |
RightArm | number | {@link Pose} | Right arm pose |
LeftHand | number | {@link Pose} | Left hand pose. |
LeftHandThumb1 | number | {@link Pose} | Left thumb 1 finger joint pose. |
LeftHandThumb2 | number | {@link Pose} | Left thumb 2 finger joint pose. |
LeftHandThumb3 | number | {@link Pose} | Left thumb 3 finger joint pose. |
LeftHandThumb4 | number | {@link Pose} | Left thumb 4 finger joint pose. |
LeftHandIndex1 | number | {@link Pose} | Left index 1 finger joint pose. |
LeftHandIndex2 | number | {@link Pose} | Left index 2 finger joint pose. |
LeftHandIndex3 | number | {@link Pose} | Left index 3 finger joint pose. |
LeftHandIndex4 | number | {@link Pose} | Left index 4 finger joint pose. |
LeftHandMiddle1 | number | {@link Pose} | Left middle 1 finger joint pose. + * |
LeftHandMiddle2 | number | {@link Pose} | Left middle 2 finger joint pose. + * |
LeftHandMiddle3 | number | {@link Pose} | Left middle 3 finger joint pose. + * |
LeftHandMiddle4 | number | {@link Pose} | Left middle 4 finger joint pose. + * |
LeftHandRing1 | number | {@link Pose} | Left ring 1 finger joint pose. |
LeftHandRing2 | number | {@link Pose} | Left ring 2 finger joint pose. |
LeftHandRing3 | number | {@link Pose} | Left ring 3 finger joint pose. |
LeftHandRing4 | number | {@link Pose} | Left ring 4 finger joint pose. |
LeftHandPinky1 | number | {@link Pose} | Left pinky 1 finger joint pose. |
LeftHandPinky2 | number | {@link Pose} | Left pinky 2 finger joint pose. |
LeftHandPinky3 | number | {@link Pose} | Left pinky 3 finger joint pose. |
LeftHandPinky4 | number | {@link Pose} | Left pinky 4 finger joint pose. |
RightHand | number | {@link Pose} | Right hand pose. |
RightHandThumb1 | number | {@link Pose} | Right thumb 1 finger joint pose. + * |
RightHandThumb2 | number | {@link Pose} | Right thumb 2 finger joint pose. + * |
RightHandThumb3 | number | {@link Pose} | Right thumb 3 finger joint pose. + * |
RightHandThumb4 | number | {@link Pose} | Right thumb 4 finger joint pose. + * |
RightHandIndex1 | number | {@link Pose} | Right index 1 finger joint pose. + * |
RightHandIndex2 | number | {@link Pose} | Right index 2 finger joint pose. + * |
RightHandIndex3 | number | {@link Pose} | Right index 3 finger joint pose. + * |
RightHandIndex4 | number | {@link Pose} | Right index 4 finger joint pose. + * |
RightHandMiddle1 | number | {@link Pose} | Right middle 1 finger joint pose. + * |
RightHandMiddle2 | number | {@link Pose} | Right middle 2 finger joint pose. + * |
RightHandMiddle3 | number | {@link Pose} | Right middle 3 finger joint pose. + * |
RightHandMiddle4 | number | {@link Pose} | Right middle 4 finger joint pose. + * |
RightHandRing1 | number | {@link Pose} | Right ring 1 finger joint pose. |
RightHandRing2 | number | {@link Pose} | Right ring 2 finger joint pose. |
RightHandRing3 | number | {@link Pose} | Right ring 3 finger joint pose. |
RightHandRing4 | number | {@link Pose} | Right ring 4 finger joint pose. |
RightHandPinky1 | number | {@link Pose} | Right pinky 1 finger joint pose. + * |
RightHandPinky2 | number | {@link Pose} | Right pinky 2 finger joint pose. + * |
RightHandPinky3 | number | {@link Pose} | Right pinky 3 finger joint pose. + * |
RightHandPinky4 | number | {@link Pose} | Right pinky 4 finger joint pose. + * |
LeftFoot | number | {@link Pose} | Left foot pose. |
RightFoot | number | {@link Pose} | Right foot pose. |
Trackers | |||
TrackedObject00 | number | {@link Pose} | Tracker 0 pose. |
TrackedObject01 | number | {@link Pose} | Tracker 1 pose. |
TrackedObject02 | number | {@link Pose} | Tracker 2 pose. |
TrackedObject03 | number | {@link Pose} | Tracker 3 pose. |
TrackedObject04 | number | {@link Pose} | Tracker 4 pose. |
TrackedObject05 | number | {@link Pose} | Tracker 5 pose. |
TrackedObject06 | number | {@link Pose} | Tracker 6 pose. |
TrackedObject07 | number | {@link Pose} | Tracker 7 pose. |
TrackedObject08 | number | {@link Pose} | Tracker 8 pose. |
TrackedObject09 | number | {@link Pose} | Tracker 9 pose. |
TrackedObject10 | number | {@link Pose} | Tracker 10 pose. |
TrackedObject11 | number | {@link Pose} | Tracker 11 pose. |
TrackedObject12 | number | {@link Pose} | Tracker 12 pose. |
TrackedObject13 | number | {@link Pose} | Tracker 13 pose. |
TrackedObject14 | number | {@link Pose} | Tracker 14 pose. |
TrackedObject15 | number | {@link Pose} | Tracker 15 pose. |
A {@link Controller} mapping object that can contain a set of routes that map:
+ *Create by one of the following methods:
+ *Enable the mapping using {@link MappingObject#enable|enable} or {@link Controller.enableMapping} for it to take effect. + * + *
Mappings and their routes are applied according to the following rules:
+ *"Controller.Hardware."
can be omitted.
+ * @property {boolean} [peek=false] - If true
then debug is enabled per {@link RouteObject#debug}.
+ * @property {string|string[]} [when=[]] - One or more numeric {@link Controller.Hardware} property names which are evaluated
+ * as booleans and ANDed together. Prepend with a !
to use the logical NOT of the property value. The leading
+ * "Controller.Hardware."
can be omitted from the property names.
+ * @property {Controller.MappingJSONFilter|Controller.MappingJSONFilter[]} [filters=[]] - One or more filters in the route.
+ * @property {string} to - The name of a {@link Controller.Actions} or {@link Controller.Standard} property. The leading
+ * "Controller."
can be omitted.
+ */
+
+/**jsdoc
+ * An axis pair in a {@link Controller.MappingJSONRoute}.
+ * @typedef {object} Controller.MappingJSONAxis
+ * @property {string[][]} makeAxis - A two-member array of single-member arrays of {@link Controller.Hardware} property names.
+ * The leading "Controller.Hardware."
can be omitted from the property names.
+ * @example source2 - source1
.
+ */
Q_INVOKABLE QObject* makeAxisQml(const QJSValue& source1, const QJSValue& source2);
+ /**jsdoc
+ * Create a new {@link RouteObject} from a controller output, ready to be mapped to a standard control, action, or
+ * function.
+ * @function MappingObject#from
+ * @param {Controller.Standard|Controller.Hardware|function} source - The controller output or function that is the source
+ * of the route data. If a function, it must return a number or a {@link Pose} value as the route data.
+ * @returns {RouteObject} A route ready for mapping to an action or function using {@link RouteObject} methods.
+ */
Q_INVOKABLE QObject* from(const QScriptValue& source);
+
+ /**jsdoc
+ * Create a new {@link RouteObject} from two numeric {@link Controller.Hardware} outputs, one applied in the negative
+ * direction and the other in the positive direction, ready to be mapped to a standard control, action, or function.
+ * @function MappingObject#makeAxis
+ * @param {Controller.Hardware} source1 - The first, negative-direction controller output.
+ * @param {Controller.Hardware} source2 - The second, positive-direction controller output.
+ * @returns {RouteObject} A route ready for mapping to an action or function using {@link RouteObject} methods. The data
+ * value passed to the route is the combined value of source2 - source1
.
+ * @example true
then the mapping is enabled, otherwise it is disabled.
+ * @returns {MappingObject} The mapping object, so that further routes can be added.
+ */
Q_INVOKABLE QObject* enable(bool enable = true);
+
+ /**jsdoc
+ * Disable the mapping. When disabled, the routes in the mapping have no effect.A route in a {@link MappingObject} used by the {@link Controller} API.
+ * + *Create a route using {@link MappingObject} methods and apply this object's methods to process it, terminating with
+ * {@link RouteObject#to} to apply it to a Standard
control, action, or script function.
Some methods apply to routes with number data, some apply routes with {@link Pose} data, and some apply to both route + * types.
+ *
+ * @class RouteObject
+ */
+
// TODO migrate functionality to a RouteBuilder class and make the proxy defer to that
// (for easier use in both C++ and JS)
class RouteBuilderProxy : public QObject {
@@ -33,27 +45,404 @@ class RouteBuilderProxy : public QObject {
RouteBuilderProxy(UserInputMapper& parent, Mapping::Pointer mapping, Route::Pointer route)
: _parent(parent), _mapping(mapping), _route(route) { }
+ /**jsdoc
+ * Terminate the route with a standard control, an action, or a script function. The output value from the route is
+ * sent to the specified destination.
+ * This is a QML-specific version of {@link MappingObject#to|to}: use this version in QML files.
+ * @function RouteObject#toQml
+ * @param {Controller.Standard|Controller.Actions|function} destination - The standard control, action, or JavaScript
+ * function that the route output is mapped to. For a function, the parameter can be either the name of the function or
+ * an in-line function definition.
+ */
Q_INVOKABLE void toQml(const QJSValue& destination);
+
+ /**jsdoc
+ * Process the route only if a condition is satisfied. The condition is evaluated before the route input is read, and
+ * the input is read only if the condition is true
. Thus, if the condition is not met then subsequent
+ * routes using the same input are processed.
+ * This is a QML-specific version of {@link MappingObject#to|to}: use this version in QML files.
+ * @function RouteObject#whenQml
+ * @param {condition|condition[]} expression -
A condition
may be a:
!
followed by a {@link Controller.Hardware} property, indicating the logical NOT should be
+ * used.If an array of conditions is provided, their values are ANDed together.
+ * @returns {RouteObject} TheRouteObject
with the condition added.
+ */
Q_INVOKABLE QObject* whenQml(const QJSValue& expression);
+ /**jsdoc
+ * Terminate the route with a standard control, an action, or a script function. The output value from the route is
+ * sent to the specified destination.
+ * @function RouteObject#to
+ * @param {Controller.Standard|Controller.Actions|function} destination - The standard control, action, or JavaScript
+ * function that the route output is mapped to. For a function, the parameter can be either the name of the function or
+ * an in-line function definition.
+ *
+ * @example true
then writing debug information is enabled for the route,
+ * otherwise it is disabled.
+ * @returns {RouteObject} The RouteObject
with debug output enabled or disabled.
+ * @example true
then the route is processed without marking the route's
+ * controller source as having been read.
+ * @returns {RouteObject} The RouteObject
with the peek feature enabled.
+ */
Q_INVOKABLE QObject* peek(bool enable = true);
+
+ /**jsdoc
+ * Process the route only if a condition is satisfied. The condition is evaluated before the route input is read, and
+ * the input is read only if the condition is true
. Thus, if the condition is not met then subsequent
+ * routes using the same input are processed.
+ * @function RouteObject#when
+ * @param {condition|condition[]} expression - A condition
may be a:
!
followed by a {@link Controller.Hardware} property to use the logical NOT of the property
+ * value.If an array of conditions is provided, their values are ANDed together.
+ * @returns {RouteObject} TheRouteObject
with the condition added.
+ * @example 0
or 1
without output values
+ * flickering when the input value hovers around 0.5
. For example, this enables you to use an analog input
+ * as if it were a toggle.
+ * @function RouteObject#hysteresis
+ * @param {number} min - When the input value drops below this value the output value changes to 0
.
+ * @param {number} max - When the input value rises above this value the output value changes to 1
.
+ * @returns {RouteObject} The RouteObject
with the filter applied.
+ * @example RouteObject
with the filter applied.
+ * @example RouteObject
with the filter applied.
+ * @example 0.5
is changed to
+ * -0.5
.
+ * @function RouteObject#invert
+ * @returns {RouteObject} The RouteObject
with the filter applied.
+ * @example 0.0
and catching up with the input value. As the
+ * input returns toward the dead-zone value, output values reduce to 0.0
at the dead-zone value.
+ * @function RouteObject#deadZone
+ * @param {number} min - The minimum input value at which to start sending output. For negative input values, the
+ * negative of this value is used.
+ * @returns {RouteObject} The RouteObject
with the filter applied.
+ * @example -1
, 0
, or 1
.
+ * For example, this enables you to use an analog input as if it were a toggle or, in the case of a bidirectional axis,
+ * a tri-state switch.
+ * @function RouteObject#constrainToInteger
+ * @returns {RouteObject} The RouteObject
with the filter applied.
+ * @example -1
, 0
, or
+ * 1
.0
or 1
. For example, this
+ * enables you to use an analog input as if it were a toggle.
+ * @function RouteObject#constrainToPositiveInteger
+ * @returns {RouteObject} The RouteObject
with the filter applied.
+ * @example 0
or 1
.RouteObject
with the pre-translation applied.
+ */
+ // No JSDoc example because filter not currently used.
Q_INVOKABLE QObject* translate(glm::vec3 translate);
+
+ /**jsdoc
+ * Filter {@link Pose} route values to have a pre-transform applied.
+ * @function RouteObject#transform
+ * @param {Mat4} transform - The pre-transform to apply.
+ * @returns {RouteObject} The RouteObject
with the pre-transform applied.
+ */
+ // No JSDoc example because filter not currently used.
Q_INVOKABLE QObject* transform(glm::mat4 transform);
+
+ /**jsdoc
+ * Filter {@link Pose} route values to have a post-transform applied.
+ * @function RouteObject#postTransform
+ * @param {Mat4} transform - The post-transform to apply.
+ * @returns {RouteObject} The RouteObject
with the post-transform applied.
+ */
+ // No JSDoc example because filter not currently used.
Q_INVOKABLE QObject* postTransform(glm::mat4 transform);
+
+ /**jsdoc
+ * Filter {@link Pose} route values to have a pre-rotation applied.
+ * @function RouteObject#rotate
+ * @param {Quat} rotation - The pre-rotation to add to the pose.
+ * @returns {RouteObject} The RouteObject
with the pre-rotation applied.
+ */
+ // No JSDoc example because filter not currently used.
Q_INVOKABLE QObject* rotate(glm::quat rotation);
+
+ /**jsdoc
+ * Filter {@link Pose} route values to be smoothed by a low velocity filter. The filter's rotation and translation
+ * values are calculated as: (1 - f) * currentValue + f * previousValue
where
+ * f = currentVelocity / filterConstant
. At low velocities, the filter value is largely the previous
+ * value; at high velocities the value is wholly the current controller value.
+ * @function RouteObject#lowVelocity
+ * @param {number} rotationConstant - The rotational velocity, in rad/s, at which the filter value is wholly the latest
+ * controller value.
+ * @param {number} translationConstant - The linear velocity, in m/s, at which the filter value is wholly the latest
+ * controller value.
+ * @returns {RouteObject} The RouteObject
smoothed by low velocity filtering.
+ */
+ // No JSDoc example because filter not currently used.
Q_INVOKABLE QObject* lowVelocity(float rotationConstant, float translationConstant);
+
+ /**jsdoc
+ * Filter {@link Pose} route values to be smoothed by an exponential decay filter. The filter's rotation and
+ * translation values are calculated as: filterConstant * currentValue + (1 - filterConstant) *
+ * previousValue
. Values near 1 are less smooth with lower latency; values near 0 are more smooth with higher
+ * latency.
+ * @function RouteObject#exponentialSmoothing
+ * @param {number} rotationConstant - Rotation filter constant, 0.0–1.0
.
+ * @param {number} translationConstant - Translation filter constant, 0.0–1.0
.
+ * @returns {RouteObject} The RouteObject
smoothed by an exponential filter.
+ */
+ // No JSDoc example because filter used only in Vive.json.
Q_INVOKABLE QObject* exponentialSmoothing(float rotationConstant, float translationConstant);
+
+ /**jsdoc
+ * Filter numeric route values such that a value of 0.0
is changed to 1.0
, and other values
+ * are changed to 0.0
.
+ * @function RouteObject#logicalNot
+ * @returns {RouteObject} The RouteObject
with the filter applied.
+ * @example The Controller.Hardware.Keyboard
object has properties representing keyboard, mouse, and display touch
+ * events. The property values are integer IDs, uniquely identifying each output. Read-only. These can be mapped to
+ * actions or functions or Controller.Standard
items in a {@link RouteObject} mapping. For presses, each data
+ * value is either 1.0
for "true" or 0.0
for "false".
Property | Type | Data | Description |
---|---|---|---|
0 – 9 | number | number | A "0" – "1" key on the + * keyboard or keypad is pressed. |
A – Z | number | number | A "A" – "Z" key on the + * keyboard is pressed. |
Space | number | number | The space bar on the keyboard is pressed. |
Tab | number | number | The tab key on the keyboard is pressed. |
Shift | number | number | The shift key on the keyboard is pressed. |
Control | number | number | The control key on the keyboard is pressed. (The + * "Command" key on OSX.) |
Left | number | number | The left arrow key on the keyboard or keypad is pressed. + * |
Right | number | number | The right arrow key on the keyboard or keypad is + * pressed. |
Up | number | number | The up arrow key on the keyboard or keypad is pressed. + * |
Down | number | number | The down arrow key on the keyboard or keypad is pressed. + * |
PgUp | number | number | The page up key on the keyboard or keypad is pressed. + * |
PgDown | number | number | The page down key on the keyboard or keypad is pressed. + * |
LeftMouseButton | number | number | The left mouse button pressed. |
MiddleMouseButton | number | number | The middle mouse button pressed. |
RightMouseButton | number | number | The right mouse button pressed. |
LeftMouseClicked | number | number | The left mouse button clicked. |
MiddleMouseClicked | number | number | The middle mouse button clicked. |
RightMouseClicked | number | number | The right mouse button clicked. |
MouseMoveRight | number | number | The mouse moved right. |
MouseMoveLeft | number | number | The mouse moved left. |
MouseMoveUp | number | number | The mouse moved up. |
MouseMoveDown | number | number | The mouse moved down. |
MouseX | number | number | The mouse x-coordinate changed. The data value is its + * new x-coordinate value. |
MouseY | number | number | The mouse y-coordinate changed. The data value is its + * new y-coordinate value. |
MouseWheelRight | number | number | The mouse wheel rotated left. The data value
+ * is the number of units rotated (typically 1.0 ). |
MouseWheelLeft | number | number | The mouse wheel rotated left. The data value
+ * is the number of units rotated (typically 1.0 ). |
MouseWheelUp | number | number | The mouse wheel rotated up. The data value
+ * is the number of units rotated (typically 1.0 ). |
MouseWheelDown | number | number | The mouse wheel rotated down. The data value
+ * is the number of units rotated (typically 1.0 ). |
TouchpadRight | number | number | The average touch on a touch-enabled device + * moved right. The data value is how far the average position of all touch points moved. |
TouchpadLeft | number | number | The average touch on a touch-enabled device + * moved left. The data value is how far the average position of all touch points moved. |
TouchpadUp | number | number | The average touch on a touch-enabled device + * moved up. The data value is how far the average position of all touch points moved. |
TouchpadDown | number | number | The average touch on a touch-enabled device + * moved down. The data value is how far the average position of all touch points moved. |
"a"
for the "A" key if the Shift is not
+ * pressed, "F1"
for the F1 key, "SPACE"
for the space bar.
+ * @property {boolean} isShifted - true
if a Shift key was pressed when the event was generated, otherwise
+ * false
.
+ * @property {boolean} isMeta - true
if a meta key was pressed when the event was generated, otherwise
+ * false
. On Windows the "meta" key is the Windows key; on OSX it is the Control (Splat) key.
+ * @property {boolean} isControl - true
if a control key was pressed when the event was generated, otherwise
+ * false
. On Windows the "control" key is the Ctrl key; on OSX it is the Command key.
+ * @property {boolean} isAlt - true
if an Alt key was pressed when the event was generated, otherwise
+ * false
.
+ * @property {boolean} isKeypad - true
if the key is on the numeric keypad, otherwise false
.
+ * @property {boolean} isAutoRepeat - true
if the event is a repeat for key that is being held down, otherwise
+ * false
.
+ * @example "LEFT"
, "MIDDLE"
, or "RIGHT"
if a button press or release
+ * caused the event, otherwise "NONE"
.
+ * @property {boolean} isLeftButton - true
if the left button was pressed when the event was generated, otherwise
+ * false
.
+ * @property {boolean} isMiddleButton - true
if the middle button was pressed when the event was generated,
+ * otherwise false
.
+ * @property {boolean} isRightButton - true
if the right button was pressed when the event was generated,
+ * otherwise false
.
+ * @property {boolean} isShifted - true
if the Shift key was pressed when the event was generated, otherwise
+ * false
.
+ * @property {boolean} isMeta - true
if the "meta" key was pressed when the event was generated, otherwise
+ * false
. On Windows the "meta" key is the Windows key; on OSX it is the Control (Splat) key.
+ * @property {boolean} isControl - true
if the "control" key was pressed when the event was generated, otherwise
+ * false
. On Windows the "control" key is the Ctrl key; on OSX it is the Command key.
+ * @property {boolean} isAlt - true
if the Alt key was pressed when the event was generated, otherwise
+ * false
.
+ * @example true
if the touch point has just been pressed, otherwise false
.
+ * @property {boolean} isMoved - true
if the touch point has moved, otherwise false
.
+ * @property {boolean} isStationary - true
if the touch point has not moved, otherwise false
.
+ * @property {boolean} isReleased - true
if the touch point has just been released, otherwise false
.
+ * @property {boolean} isShifted - true
if the Shift key was pressed when the event was generated, otherwise
+ * false
.
+ * @property {boolean} isMeta - true
if the "meta" key was pressed when the event was generated, otherwise
+ * false
. On Windows the "meta" key is the Windows key; on OSX it is the Control (Splat) key.
+ * @property {boolean} isControl - true
if the "control" key was pressed when the event was generated, otherwise
+ * false
. On Windows the "control" key is the Ctrl key; on OSX it is the Command key.
+ * @property {boolean} isAlt - true
if the Alt key was pressed when the event was generated, otherwise
+ * false
.
+ * @property {number} touchPoints - Integer number of touch points.
+ * @property {Vec2[]} points - The coordinates of the touch points.
+ * @property {number} radius - The radius of a circle centered on their average position that encompasses the touch points.
+ * @property {boolean} isPinching - true
if the radius
has reduced since the most recent touch event
+ * with a different radius
value, otherwise false
.
+ * @property {boolean} isPinchOpening - true
if the radius
has increased since the most recent touch
+ * event with a different radius
value, otherwise false
.
+ * @property {number} angle - An angle calculated from the touch points, in degrees.
+ * @property {number} deltaAngle - The change in the angle
value since the previous touch event, in degrees, if
+ * the number of touch points is the same, otherwise 0.0
.
+ * @property {number[]} angles - The angles of each touch point about the center of all the touch points, in degrees.
+ * @property {boolean} isRotating - true
if the angle
of the touch event has changed since the
+ * previous touch event and the number of touch points is the same, otherwise false
.
+ * @property {string} rotating - "clockwise"
or "counterClockwise"
if the angle
of the
+ * touch event has changed since the previous touch event and the number of touch points is the same, otherwise
+ * "none"
.
+ *
+ * @example "VERTICAL"
for a typical mouse;
+ * "HORIZONTAL"
for a "horizontal" wheel.
+ * @property {boolean} isLeftButton - true
if the left button was pressed when the event was generated, otherwise
+ * false
.
+ * @property {boolean} isMiddleButton - true
if the middle button was pressed when the event was generated,
+ * otherwise false
.
+ * @property {boolean} isRightButton - true
if the right button was pressed when the event was generated,
+ * otherwise false
.
+ * @property {boolean} isShifted - true
if the Shift key was pressed when the event was generated, otherwise
+ * false
.
+ * @property {boolean} isMeta - true
if the "meta" key was pressed when the event was generated, otherwise
+ * false
. On Windows the "meta" key is the Windows key; on OSX it is the Control (Splat) key.
+ * @property {boolean} isControl - true
if the "control" key was pressed when the event was generated, otherwise
+ * false
. On Windows the "control" key is the Ctrl key; on OSX it is the Command key.
+ * @property {boolean} isAlt - true
if the Alt key was pressed when the event was generated, otherwise
+ * false
.
+ * @example 0x02000000
33554432
0x04000000
67108864
0x08000000
134217728
0x10000000
268435456
0x20000000
536870912
0x40000000
1073741824
The Controller.Hardware.OculusTouch
object has properties representing Oculus Rift. The property values are
+ * integer IDs, uniquely identifying each output. Read-only. These can be mapped to actions or functions or
+ * Controller.Standard
items in a {@link RouteObject} mapping.
Property | Type | Data | Description |
---|---|---|---|
Buttons | |||
A | number | number | "A" button pressed. |
B | number | number | "B" button pressed. |
X | number | number | "X" button pressed. |
Y | number | number | "Y" button pressed. |
LeftApplicationMenu | number | number | Left application menu button pressed. + * |
RightApplicationMenu | number | number | Right application menu button pressed. + * |
Sticks | |||
LX | number | number | Left stick x-axis scale. |
LY | number | number | Left stick y-axis scale. |
RX | number | number | Right stick x-axis scale. |
RY | number | number | Right stick y-axis scale. |
LS | number | number | Left stick button pressed. |
RS | number | number | Right stick button pressed. |
LSTouch | number | number | Left stick is touched. |
RSTouch | number | number | Right stick is touched. |
Triggers | |||
LT | number | number | Left trigger scale. |
RT | number | number | Right trigger scale. |
LeftGrip | number | number | Left grip scale. |
RightGrip | number | number | Right grip scale. |
Finger Abstractions | |||
LeftPrimaryThumbTouch | number | number | Left thumb touching primary thumb + * button. |
LeftSecondaryThumbTouch | number | number | Left thumb touching secondary thumb + * button. |
LeftThumbUp | number | number | Left thumb not touching primary or secondary + * thumb buttons. |
RightPrimaryThumbTouch | number | number | Right thumb touching primary thumb + * button. |
RightSecondaryThumbTouch | number | number | Right thumb touching secondary thumb + * button. |
RightThumbUp | number | number | Right thumb not touching primary or secondary + * thumb buttons. |
LeftPrimaryIndexTouch | number | number | Left index finger is touching primary + * index finger control. |
LeftIndexPoint | number | number | Left index finger is pointing, not touching + * primary or secondary index finger controls. |
RightPrimaryIndexTouch | number | number | Right index finger is touching primary + * index finger control. |
RightIndexPoint | number | number | Right index finger is pointing, not touching + * primary or secondary index finger controls. |
Avatar Skeleton | |||
Head | number | {@link Pose} | Head pose. |
LeftHand | number | {@link Pose} | Left hand pose. |
RightHand | number | {@link Pose} | right hand pose. |
The Controller.Hardware.Vive
object has properties representing Vive. The property values are integer IDs,
+ * uniquely identifying each output. Read-only. These can be mapped to actions or functions or
+ * Controller.Standard
items in a {@link RouteObject} mapping.
Property | Type | Data | Description |
---|---|---|---|
Touch Pad (Sticks) | |||
LX | number | number | Left touch pad x-axis scale. |
LY | number | number | Left touch pad y-axis scale. |
RX | number | number | Right stick x-axis scale. |
RY | number | number | Right stick y-axis scale. |
LS | number | number | Left touch pad pressed. |
LS_CENTER | number | number | Left touch pad center pressed. |
LS_X | number | number | Left touch pad pressed x-coordinate. |
LS_Y | number | number | Left touch pad pressed y-coordinate. |
RS | number | number | Right touch pad pressed. |
RS_CENTER | number | number | Right touch pad center pressed. |
RS_X | number | number | Right touch pad pressed x-coordinate. |
RS_Y | number | number | Right touch pad pressed y-coordinate. |
LSTouch | number | number | Left touch pad is touched. |
RSTouch | number | number | Right touch pad is touched. |
Triggers | |||
LT | number | number | Left trigger scale. |
RT | number | number | Right trigger scale. |
LTClick | number | number | Left trigger click. |
RTClick | number | number | Right trigger click. |
LeftGrip | number | number | Left grip scale. |
RightGrip | number | number | Right grip scale. |
Avatar Skeleton | |||
Hips | number | {@link Pose} | Hips pose. |
Spine2 | number | {@link Pose} | Spine2 pose. |
Head | number | {@link Pose} | Head pose. |
LeftArm | number | {@link Pose} | Left arm pose. |
RightArm | number | {@link Pose} | Right arm pose |
LeftHand | number | {@link Pose} | Left hand pose. |
RightHand | number | {@link Pose} | Right hand pose. |
Trackers | |||
TrackedObject00 | number | {@link Pose} | Tracker 0 pose. |
TrackedObject01 | number | {@link Pose} | Tracker 1 pose. |
TrackedObject02 | number | {@link Pose} | Tracker 2 pose. |
TrackedObject03 | number | {@link Pose} | Tracker 3 pose. |
TrackedObject04 | number | {@link Pose} | Tracker 4 pose. |
TrackedObject05 | number | {@link Pose} | Tracker 5 pose. |
TrackedObject06 | number | {@link Pose} | Tracker 6 pose. |
TrackedObject07 | number | {@link Pose} | Tracker 7 pose. |
TrackedObject08 | number | {@link Pose} | Tracker 8 pose. |
TrackedObject09 | number | {@link Pose} | Tracker 9 pose. |
TrackedObject10 | number | {@link Pose} | Tracker 10 pose. |
TrackedObject11 | number | {@link Pose} | Tracker 11 pose. |
TrackedObject12 | number | {@link Pose} | Tracker 12 pose. |
TrackedObject13 | number | {@link Pose} | Tracker 13 pose. |
TrackedObject14 | number | {@link Pose} | Tracker 14 pose. |
TrackedObject15 | number | {@link Pose} | Tracker 15 pose. |