This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
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
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

engine.vive Functions

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

Notice
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:

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

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

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

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

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:

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: 2020-01-14
Build: ()