engine.vive Functions
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
This set of functions is available when the AppVive plugin is loaded.
AppVive plugin cannot be used in a Qt-based application.
If AppVive 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.
See also#
A UnigineScript API sample <UnigineSDK>/data/samples/plugins/app_vive_00
AppVive Class
Members
vec2 engine.vive.getControllerAxis ( int device_num, int axis_num ) #
Returns the coordinates of the specified controller axis along the X and Y axes.Arguments
- int device_num - Device ID.
- int axis_num - Axis number.
Return value
X and Y in the range of [-1;1] ([0;1] for a trigger).bool engine.vive.getControllerButtonPressed ( int device_num, int button ) #
Returns the value indicating if the specified button is pressed.Arguments
- int device_num - Device ID.
- int button - A button, one of the APP_VIVE_BUTTON_ variables.
Return value
true if the button is pressed; otherwise - false.bool engine.vive.getControllerButtonTouched ( int device_num, int button ) #
Returns the value indicating if the specified button is touched.Arguments
- int device_num - Device ID.
- int button - A button, one of the APP_VIVE_BUTTON_ variables.
Return value
true if the button is pressed; otherwise - false.int engine.vive.getControllerPacketNum ( int device_num ) #
Returns the number of the controller packet.Arguments
- int device_num - Device ID.
Return value
Number of the controller packet.void engine.vive.setControllerVibration ( int device_num, int duration ) #
Sets the vibration of the given duration and amplitude.Arguments
- int device_num - Device ID.
- int duration - Duration of the vibration.
vec3 engine.vive.getDeviceAngularVelocity ( int device_num ) #
Returns a device angular velocity, in radians per second.Arguments
- int device_num - Device ID.
Return value
Angular velocity.bool engine.vive.isDeviceConnected ( int device_num ) #
Returns a value indicating if the device connected to the slot.Arguments
- int device_num - Device ID.
Return value
true - connected; false - not connected.mat4 engine.vive.getDeviceTransform ( int device_num ) #
Returns a single pose for a tracked device.Arguments
- int device_num - Device ID.
Return value
Identity matrix.int engine.vive.getDeviceType ( int device_num ) #
Returns the device type.Arguments
- int device_num - Device ID.
Return value
Device type, one of the APP_VIVE_DEVICE_ variables.vec3 engine.vive.getDeviceVelocity ( int device_num ) #
Returns a device velocity in tracker space, in meters per second.Arguments
- int device_num - Device ID.
Return value
Velocity.void engine.vive.setHeadPositionLock ( bool lock ) #
Locks the head position.Arguments
- bool lock - true to lock the head position.
bool engine.vive.isHeadPositionLocked ( ) #
Returns the value indicating if the head position is locked.Return value
true if the head position is locked; otherwise - false.void engine.vive.setHeadRotationLock ( bool lock ) #
Locks the head rotation.Arguments
- bool lock - true to lock the head rotation.
bool engine.vive.isHeadRotationLocked ( ) #
Returns the value indicating if the head rotation is locked.Return value
true if the head rotation is locked; otherwise - false.bool engine.vive.isPoseValid ( int device_num ) #
Returns a value indicating if the device pose is valid.Arguments
- int device_num - Device ID.
Return value
true - valid; false - invalid.int engine.vive.getTrackingResult ( int device_num ) #
Returns the value indicating the tracking result:- Uninitialized
- Calibrating in progress
- Calibrating out of range
- Running correctly
- Running out of range
Arguments
- int device_num - 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 APP_VIVE_VIEWPORT_ variables.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 APP_VIVE_VIEWPORT_ variables.
int engine.vive.getMaxTrackedDeviceCount ( ) #
Returns the maximum value of tracked devices.Return value
The maximum value of tracked devices.int engine.vive.getControllerStateAxisCount ( ) #
Returns a number of axes.Return value
Number of axes.int engine.vive.getDeviceAxisType ( int device_num, int axis_num ) #
Returns the value that identifies what type of axis is on the indicated controller.Arguments
- int device_num - Device ID.
- int axis_num - Axis number.
Return value
Axis of a corresponding type. One of the APP_VIVE_AXIS_ variables.String engine.vive.getDeviceManufacturerName ( int device ) #
Returns the manufacturer name of the specified device.Arguments
- int device - Device ID.
Return value
Manufacturer name.String engine.vive.getDeviceModelNumber ( int device ) #
Returns the model of the specified device.Arguments
- int device - Device ID.
Return value
Model.int engine.vive.getControllerRole ( int device_num ) #
Returns a specific role associated with a tracked device.Arguments
- int device_num - Device ID.
Return value
Role associated with a tracked device. One of the APP_VIVE_CONTROLLER_ROLE_ variables.Last update:
2021-12-13
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)