This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
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
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

VR Input System

The VR input system allows managing user input from VR controllers, head-mounted displays (HMDs), base stations, and trackers. It supports a wide range of VR devices, enabling you to utilize several devices from various vendors and process input from them.

The InputVRDevice class provides access to properties and settings common for all VR devices (for example, a device name).

Warning
VR plugins (OpenVR, Varjo, Oculus) that implement similar functionality are considered deprecated and will be removed in the next SDK release.

VR Controllers#

Controllers serve as a primary interface for VR input. There are three types of VR controllers: left-hand, right-hand controllers, and a treadmill. You can get the controller's type and check whether it is a hand controller by using the corresponding methods of the InputVRController class.

The VR input system supports a range of controller models compatible with OpenVR, Varjo, and Oculus devices. In this article, we will consider the following models of controllers as examples:

  • HTC Vive (compatible with OpenVR and Varjo devices)
  • Oculus Touch (compatible only with Oculus HMDs and works via OpenVR)
  • Valve Knuckles (compatible with OpenVR and Varjo devices)

UNIGINE API provides access to the VR controller inputs — axes and buttons.

  • Buttons are mapped to the controller's buttons that can be pressed, touched, or released.
  • Axes detect 1-dimensional movement of the control and have more complex behavior.

    Depending on the type of the VR controller, the number of axes differs. UNIGINE supports up to 4 axes. But usually, a controller has 3.

    In UNIGINE, an axis can be mapped to a control of one of the following types (also referred to as an axis type): trackpad, joystick, or trigger. Each axis type has a different number of reserved axes. For example, combining two axes of a joystick or trackpad allows tracking of 2-dimensional movement along the X and Y axes.

    Notice
    You cannot know in advance which type of controller is connected, so UNIGINE API allows you to identify the number of supported axes and check their types.

OpenVR Controllers#

This chapter showcases examples of inputs on different types of OpenVR-supported controllers — HTC Vive, Oculus Touch, and Valve Knuckles controllers — and provides information on how these inputs are mapped to the buttons and axes within the UNIGINE input system.

Notice
You can find the list of common OpenVR controller types here.

HTC Vive Controller Inputs#

Notice
This type of controller is supported by Varjo devices as well.

HTC Vive Controller Axes and Buttons (image sourced from vive.com, courtesy of vive.com)
Button/
Axis
Description Interaction Type UNIGINE Button/
Axis
UNIGINE Axis Number Axis Range
1 Menu Button Press
  • Left hand: VR_BUTTON_X
  • Right hand: VR_BUTTON_A
2 Trackpad Press / Touch
  • Left hand: VR_BUTTON_AXIS_0_LEFT
  • Right hand: VR_BUTTON_AXIS_0_RIGHT
2 Trackpad Horizontal / Vertical Movement
  • 0 for the X axis
  • 1 for the Y axis
[-1;1]
  • When moving along the X axis: -1 for right-to-left movement, 1 for left-to-right movement
  • When moving along the Y axis: -1 for forward movement, 1 for backward movement
3 System button Press
  • Left hand: VR_BUTTON_SYSTEM_LEFT
  • Right hand: VR_BUTTON_SYSTEM_RIGHT
7 Trigger Press / Touch
  • Left hand: VR_BUTTON_AXIS_1_LEFT
  • Right hand: VR_BUTTON_AXIS_1_RIGHT
7 Trigger Squeeze 2 for the Trigger axis [0;1]
8 Grip button Press
  • Left hand: VR_BUTTON_GRIP_LEFT
  • Right hand: VR_BUTTON_GRIP_RIGHT

Oculus Touch Controller Inputs#

Notice
This type of controller works via OpenVR and is compatible with Oculus HMDs only.

Oculus Touch Controller Axes and Buttons (image courtesy of developer.oculus.com)
Button/
Axis
Interaction Type UNIGINE Button/
Axis
UNIGINE Axis Number Axis Range
  • Button.One
  • Button.Three
Press
  • Left hand: VR_BUTTON_X
  • Right hand: VR_BUTTON_A
  • Button.Two
  • Button.Four
Press
  • Left hand: VR_BUTTON_Y
  • Right hand: VR_BUTTON_B
  • Button.PrimaryThumbstick
  • Button.SecondaryThumbstick
Press / Touch
  • Left hand: VR_BUTTON_AXIS_0_LEFT
  • Right hand: VR_BUTTON_AXIS_0_RIGHT
  • Axis2D.PrimaryThumbstick
  • Axis2D.SecondaryThumbstick
Horizontal / Vertical
Movement
  • 0 for the X axis
  • 1 for the Y axis
[-1;1]
  • When moving along the X axis: -1 for right-to-left movement, 1 for left-to-right movement
  • When moving along the Y axis: -1 for forward movement, 1 for backward movement
  • Axis1D.PrimaryIndexTrigger
  • Axis1D.SecondaryIndexTrigger
Press / Touch
  • Left hand: VR_BUTTON_AXIS_1_LEFT
  • Right hand: VR_BUTTON_AXIS_1_RIGHT
  • Axis1D.PrimaryIndexTrigger
  • Axis1D.SecondaryIndexTrigger
Squeeze 2 for the Trigger axis [0;1]
  • Axis1D.PrimaryHandTrigger
  • Axis1D.SecondaryHandTrigger
Squeeze
  • Left hand: VR_BUTTON_GRIP_LEFT
  • Right hand: VR_BUTTON_GRIP_RIGHT

Valve Knuckles Controller Inputs#

Notice
This type of controller is supported by Varjo devices as well.

Valve Knuckles controller axes and buttons (Image sourced from steamcommunity.com, courtesy of steamcommunity.com)
Notice
Currently, UNIGINE doesn't offer support for the Force Sensor and Finger Tracking inputs.
Button/
Axis
Interaction Type UNIGINE Button/
Axis
UNIGINE Axis Number Axis Range
A Button Press
  • Left hand: VR_BUTTON_GRIP_LEFT
  • Right hand: VR_BUTTON_GRIP_RIGHT
B Button Press
  • Left hand: VR_BUTTON_X
  • Right hand: VR_BUTTON_A
System Button Press
  • Left hand: VR_BUTTON_SYSTEM_LEFT
  • Right hand: VR_BUTTON_SYSTEM_RIGHT
Trigger Press / Touch
  • Left hand: VR_BUTTON_AXIS_1_LEFT
  • Right hand: VR_BUTTON_AXIS_1_RIGHT
Trigger Squeeze 2 for the Trigger axis [0;1]
Track Button (Trackpad) Press / Touch
  • Left hand: VR_BUTTON_AXIS_0_LEFT
  • Right hand: VR_BUTTON_AXIS_0_RIGHT
Track Button (Trackpad) Horizontal / Vertical Movement
  • 0 for the X axis
  • 1 for the Y axis
[-1;1]
  • When moving along the X axis: -1 for right-to-left movement, 1 for left-to-right movement
  • When moving along the Y axis: -1 for forward movement, 1 for backward movement
Thumbstick Press / Touch
  • Left hand: VR_BUTTON_AXIS_0_LEFT
  • Right hand: VR_BUTTON_AXIS_0_RIGHT
Thumbstick Horizontal / Vertical Movement
  • 0 for the X axis
  • 1 for the Y axis
[-1;1]
  • When moving along the X axis: -1 for right-to-left movement, 1 for left-to-right movement
  • When moving along the Y axis: -1 for forward movement, 1 for backward movement
Grip Press / Touch
  • VR_BUTTON_GRIP_LEFT for the left-hand controller
  • VR_BUTTON_GRIP_RIGHT for the right-hand controller

Head-Mounted Displays#

The VR system allows you to process input from head-mounted displays (HMDs) via the InputVRHead class.

Notice
The InputVRDevice class is alos used for managing HMD input.

Base Stations#

A VR base station helps the HMD and controllers to track their exact positions, enhancing the immersion of room-scale virtual reality experience.

The InputVRDevice and InpitVRBaseStation classes is used to handle base station input.

VR Trackers#

A VR tracker allows embedding real-world objects into the VR environment. You can attach it to a real thing that needs to be tracked. In Mixed Reality, you can install the VR tracker on a camera or player to track its position in the virtual world.

The InputVRDevice and InpitVRTracker classes is used to manage tracker input.

Last update: 2023-12-19
Build: ()