engine.vive Functions
This set of functions is available when the AppVive plugin is loaded.
AppVive plugin cannot be used in a Qt-based application
If the plugin is loaded together with the engine, the HAS_APP_VIVE definition is set. This definition can be used, for example, to avoid errors if the plugin is not loaded: the code in which the plugin functions are executed can be wrapped around as follows:
#ifdef HAS_APP_VIVE
// engine.vive functions
#endif
The source code of OpenVR can be found here.
The full set of Vive devices is described here.
Vive Class
Members
vec3 engine.vive.getControllerAxis( int device, int axis )
Returns the coordinates of the specified controller axis along the X and Y axes.Arguments
- int device - A device ID.
- int axis - One of the following predefined constants:
Return value
X and Y in the range of [-1;1] ([0;1] for a trigger); Z is always zero.int engine.vive.getControllerButtonPressed( int device, int button )
Returns the value indicating if the specified button is pressed.Arguments
- int device - A device ID.
- int button - A button, one of the following predefined constants:
Return value
1 if the button is pressed; otherwise - 0.int engine.vive.getControllerButtonTouched( int device, int button )
Returns the value indicating if the specified button is touched.Arguments
- int device - A device ID.
- int button - A button, one of the following predefined constants:
Return value
1 if the button is pressed; otherwise - 0.int engine.vive.getControllerPacketNum( int device )
Returns the number of the controller packet.Arguments
- int device - A device ID.
Return value
Number of the controller packet.void engine.vive.setControllerVibration( int device, unsigned short duration )
Sets the vibration of the given duration and amplitude.Arguments
- int device - ID if the device.
- unsigned short duration - Duration of the vibration.
vec3 engine.vive.getDeviceAngularVelocity( int device )
Returns a device angular velocity, in radians per second.Arguments
- int device - A device ID.
Return value
Angular velocity.bool engine.vive.isDeviceConnected( int device )
Returns a value indicating if the device connected to the slot.Arguments
- int device - A device ID.
Return value
true - connected; false - not connected.mat4 engine.vive.getDevicePose( int device )
Returns a single pose for a tracked device.Arguments
- int device - A device ID.
Return value
Identity matrix.int engine.vive.getDeviceType( int device )
Returns the device type.Arguments
- int device - A device ID.
Return value
A device type, one of the following predefined constants:- TRACKED_DEVICE_CONTROLLER
- TRACKED_DEVICE_HMD
- TRACKED_DEVICE_INVALID
- TRACKED_DEVICE_OTHER
- TRACKED_DEVICE_TRACKING
vec3 engine.vive.getDeviceVelocity( int device )
Returns a device velocity in tracker space, in meters per second.Arguments
- int device - A device ID.
Return value
Velocity.void engine.vive.setHeadPositionLock( int lock )
Locks the head position.Arguments
- int lock - 1 to lock the head position.
int engine.vive.isHeadPositionLocked( )
Returns the value indicating if the head position is locked.Return value
1 if the head position is locked; otherwise - 0.void engine.vive.setHeadRotationLock( int lock )
Locks the head rotation.Arguments
- int lock - 1 to lock the head rotation.
int engine.vive.isHeadRotationLocked( )
Returns the value indicating if the head rotation is locked.Return value
1 if the head rotation is locked; otherwise - 0.bool engine.vive.isPoseValid( int device )
Returns a value indicating if the device pose is valid.Arguments
- int device - A device ID.
Return value
true - valid; false - invalid.int engine.vive.getTrackingResult( int device )
Returns the value indicating the tracking result:- Uninitialized
- Calibrating in progress
- Calibrating out of range
- Running correctly
- Running out of range
Arguments
- int device - A device ID.
Return value
Tracking result.int engine.vive.getViewportMode( )
Returns a value indicating the current viewport mode, that determines the type of image to be displayed in the viewport.Return value
Current viewport mode. One of the following values:- 0 - no image (black screen)
- 1 - mono image
- 2 - stereo image (left and right eye)
void engine.vive.setViewportMode( int mode )
Sets the viewport mode, that determines the type of image to be displayed in the viewport.Arguments
- int mode - Viewport mode. One of the following values:
- 0 - no image (black screen)
- 1 - mono image
- 2 - stereo image (left and right eye)
Last update:
2018-12-27
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)