UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes

Unigine::Plugins::AppVive Class

Header: #include <plugins/UnigineAppVive.h>

This set of functions is available when the AppVive or AppVarjo plugin is loaded.

Notice
AppVive and AppVarjo plugins cannot be used in a Qt-based application.

If AppVive or AppVarjo 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:

Source code (UnigineScript)
#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

Enums

CONTROLLER_ROLE#

NameDescription
CONTROLLER_ROLE_INVALID = 0Invalid value for controller type.
CONTROLLER_ROLE_LEFT_HAND = 1Tracked device is associated with the left hand.
CONTROLLER_ROLE_RIGHT_HAND = 2Tracked device is associated with the right hand.
CONTROLLER_ROLE_OPT_OUT = 3Tracked device is opting out of left/right hand.
CONTROLLER_ROLE_TREADMILL = 4Tracked device is a treadmill.
CONTROLLER_ROLE_MAX = 5Indicates the maximum number of controller roles.

BUTTON#

NameDescription
BUTTON_SYSTEM = 0The system button. These events are not visible to applications and are used internally to bring up the Steam Overlay or the Steam Client.
BUTTON_APPLICATIONMENU = 1The application menu button.
BUTTON_GRIP = 2The grip button.
BUTTON_DPAD_LEFT = 3The sensor panel left button.
BUTTON_DPAD_UP = 4The sensor panel up button.
BUTTON_DPAD_RIGHT = 5The sensor panel right button.
BUTTON_DPAD_DOWN = 6The sensor panel down button.
BUTTON_A = 7The button reserved for manual controllers.
BUTTON_AXIS0 = 32The axis reserved for manual controllers.
BUTTON_AXIS1 = 33The axis reserved for manual controllers.
BUTTON_AXIS2 = 34The axis reserved for manual controllers.
BUTTON_AXIS3 = 35The axis reserved for manual controllers.
BUTTON_AXIS4 = 36The axis reserved for manual controllers.
BUTTON_STEAMVR_TOUCHPAD = 32The touchpad on the SteamVR controller. It is the same as BUTTON_AXIS0.
BUTTON_STEAMVR_TRIGGER = 33The trigger on the SteamVR controller. It is the same as BUTTON_AXIS1.
BUTTON_DASHBOARD_BACK = 2The back to dashboard button.
BUTTON_MAX = 64This is not an actual button. It just indicates the maximum number of buttons in the system.

AXIS#

NameDescription
AXIS_NONE = 0No axis is identified on the controller.
AXIS_TRACKPAD = 1An axis of a trackpad type.
AXIS_JOYSTICK = 2An axis of a joystick type.
AXIS_TRIGGER = 3An axis of a trigger type.

DEVICE#

NameDescription
DEVICE_INVALID = 0A tracked device with an invalid index.
DEVICE_HMD = 1A tracked head-mounted display.
DEVICE_CONTROLLER = 2A tracked controller.
DEVICE_GENERIC_TRACKER = 3A tracked tracker device (Vive Tracker).
DEVICE_TRACKING = 4A tracked camera and base stations that serve as tracking reference points.

VIEWPORT#

NameDescription
VIEWPORT_BLACK_SCREEN = 0No image (black screen).
VIEWPORT_MONO = 1Mono image.
VIEWPORT_STEREO = 2Stereo image (left and right eye).

Members


Math::vec2 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 getControllerButtonPressed ( int device_num, AppVive::BUTTON button ) #

Returns the value indicating if the specified button is pressed.

Arguments

  • int device_num - Device ID.
  • AppVive::BUTTON button - A button, one of the BUTTON variables.

Return value

true if the button is pressed; otherwise - false.

bool getControllerButtonTouched ( int device_num, AppVive::BUTTON button ) #

Returns the value indicating if the specified button is touched.

Arguments

  • int device_num - Device ID.
  • AppVive::BUTTON button - A button, one of the BUTTON variables.

Return value

true if the button is pressed; otherwise - false.

int 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 setControllerVibration ( int device_num, unsigned short duration ) #

Sets the vibration of the given duration and amplitude.

Arguments

  • int device_num - Device ID.
  • unsigned short duration - Duration of the vibration.

Math::vec3 getDeviceAngularVelocity ( int device_num ) #

Returns a device angular velocity, in radians per second.

Arguments

  • int device_num - Device ID.

Return value

Angular velocity.

bool 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.

Math::mat4 getDevicePose ( int device_num ) #

Returns a single pose for a tracked device.

Arguments

  • int device_num - Device ID.

Return value

Identity matrix.

AppVive::DEVICE getDeviceType ( int device_num ) #

Returns the device type.

Arguments

  • int device_num - Device ID.

Return value

Device type, one of the DEVICE variables.

Math::vec3 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 setHeadPositionLock ( bool lock ) #

Locks the head position.

Arguments

  • bool lock - true to lock the head position.

bool isHeadPositionLocked ( ) #

Returns the value indicating if the head position is locked.

Return value

true if the head position is locked; otherwise - false.

void setHeadRotationLock ( bool lock ) #

Locks the head rotation.

Arguments

  • bool lock - true to lock the head rotation.

bool isHeadRotationLocked ( ) #

Returns the value indicating if the head rotation is locked.

Return value

true if the head rotation is locked; otherwise - false.

bool 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 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.

AppVive::VIEWPORT 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 VIEWPORT variables.

void setViewportMode ( AppVive::VIEWPORT mode ) #

Sets the viewport mode, that determines the type of image to be displayed in the viewport.

Arguments

  • AppVive::VIEWPORT mode - Viewport mode. One of the VIEWPORT variables.

int getMaxTrackedDeviceCount ( ) #

Returns the maximum value of tracked devices.

Return value

The maximum value of tracked devices.

int getControllerStateAxisCount ( ) #

Returns a number of axes.

Return value

Number of axes.

AppVive::AXIS 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 AXIS variables.

String getDeviceManufacturerName ( int device ) #

Returns the manufacturer name of the specified device.

Arguments

  • int device - Device ID.

Return value

Manufacturer name.

String getDeviceModelNumber ( int device ) #

Returns the model of the specified device.

Arguments

  • int device - Device ID.

Return value

Model.

AppVive::CONTROLLER_ROLE 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 CONTROLLER_ROLE variables.
Last update: 2020-01-21