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
编程
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
应用程序接口
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
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

engine.vive Functions

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

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.

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)

int BUTTON_A

Description

The button reserved for manual controllers.

int BUTTON_APPLICATIONMENU

Description

The application menu button.

int BUTTON_AXIS0

Description

The axis reserved for manual controllers.

int BUTTON_AXIS1

Description

The axis reserved for manual controllers.

int BUTTON_AXIS2

Description

The axis reserved for manual controllers.

int BUTTON_AXIS3

Description

The axis reserved for manual controllers.

int BUTTON_AXIS4

Description

The axis reserved for manual controllers.

int BUTTON_DASHBOARD_BACK

Description

The back to dashboard button.

int BUTTON_DPAD_DOWN

Description

The sensor panel down button.

int BUTTON_DPAD_LEFT

Description

The sensor panel left button.

int BUTTON_DPAD_RIGHT

Description

The sensor panel right button.

int BUTTON_DPAD_UP

Description

The sensor panel up button.

int BUTTON_GRIP

Description

The grip button.

int BUTTON_MAX

Description

This is not an actual button. It just indicates the maximum number of buttons in the system.

int BUTTON_STEAMVR_TOUCHPAD

Description

This is the touchpad on the SteamVR controller. It is the same as BUTTON_AXIS0.

int BUTTON_STEAMVR_TRIGGER

Description

This is the trigger on the SteamVR controller. It is the same as BUTTON_AXIS1.

int BUTTON_SYSTEM

Description

The system button. These events are not visible to applications and are used internally to bring up the Steam Overlay or the Steam Client.

int CONTROLLER_AXIS_JOYSTICK

Description

An axis of a joystick type.

int CONTROLLER_AXIS_NONE

Description

int CONTROLLER_AXIS_TRACKPAD

Description

An axis of a trackpad type.

int CONTROLLER_AXIS_TRIGGER

Description

An axis of a trigger type.

int CONTROLLER_STATE_AXIS_COUNT

Description

A number of axes.

int MAX_TRACKED_DEVICE_COUNT

Description

The maximum value of tracked devices. Default value is 16.

int TRACKED_DEVICE_CONTROLLER

Description

A tracked controller.

int TRACKED_DEVICE_HMD

Description

A tracked head-mounted display.

int TRACKED_DEVICE_GENERIC_TRACKER

Description

A tracked tracker device (Vive Tracker).

int TRACKED_DEVICE_INVALID

Description

A tracked device with an invalid index.

int TRACKED_DEVICE_OTHER

Description

A tracked device different from base Vive types.

int TRACKED_DEVICE_TRACKING

Description

A tracked camera and base stations that serve as tracking reference points.
Last update: 2018-06-04
Build: ()