虚拟现实输入系统
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.VR输入系统允许管理来自 VR控制器、头戴式显示器(hmd)、基站和跟踪器的用户输入。它支持广泛的VR设备,使您能够利用来自不同供应商的多个设备并处理来自它们的输入。
The InputVRDevice class provides access to properties and settings common for all VR devices (for example, a device name).InputVRDevice类提供对所有VR设备通用的属性和设置的访问(例如,设备名称)。
VR ControllersVR控制器#
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.控制器作为VR输入的主要接口。有三种类型的VR控制器:左手控制器, 右手控制器和跑步机。您可以通过使用InputVRController类的相应方法获取控制器的类型并检查它是否为手动控制器。
VR输入系统支持多种控制器型号,兼容OpenVR, Varjo和Oculus设备。在本文中,我们将考虑以下控制器模型作为示例:
- HTC Vive(兼容OpenVR和Varjo设备)
- Oculus Touch(仅与Oculus hmd兼容,并通过OpenVR工作)
- Valve Knuckles(兼容OpenVR和Varjo设备)
UNIGINE API provides access to the VR controller inputs — axes and buttons.UNIGINE API提供对VR控制器输入的访问- 轴和按钮。
- Buttons are mapped to the controller's buttons that can be pressed, touched, or released.Buttons映射到控制器的按钮,这些按钮可以被按下、触摸或释放。
- 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 several axes. But usually, a controller has 3 or 4.
In UNIGINE, an axis can be mapped to a control of one of the supported types, also referred to as an axis type.
Axes检测控件的一维运动,并具有更复杂的行为。You cannot know in advance which type of controller is connected, so UNIGINE API allows you to identify the number of supported axes, check their types, find the axis index by its type via findAxisByType(), or get a state value for the axis via getAxisByType().根据VR控制器的类型不同,轴的数量也不同。UNIGINE最多支持 4轴。但通常,控制器有3。
在 UNIGINE 中,轴可以映射到以下类型之一的控件(也称为轴类型):trackpad、joystick,或触发。 每种轴类型都有不同数量的保留轴。 例如,组合操纵杆或触控板的两个轴可以跟踪沿 X 轴和 Y 轴的二维运动。
Inputs for OpenVR ControllersOpenVR控制器#
本章展示了不同类型的openvr支持的控制器上的输入示例- HTC Vive, Oculus Touch和Valve Knuckles控制器-并提供了这些输入如何映射到UNIGINE输入系统中的按钮和轴的信息。
HTC Vive Controller InputsHTC Vive控制器输入#
Button/ Axis |
Description | Interaction Type | UNIGINE Button/ Axis |
UNIGINE Axis Number | Axis Range |
---|---|---|---|---|---|
1 | Menu Button | Press |
|
||
2 | Trackpad | Press / Touch |
|
||
2 | Trackpad | Horizontal / Vertical Movement |
|
[-1;1]
|
|
3 | System button | Press |
|
||
7 | Trigger | Press / Touch |
|
||
7 | Trigger | Squeeze | 2 for the Trigger axis | [0;1] | |
8 | Grip button | Press |
|
Oculus Touch Controller InputsOculus Touch Controller输入#
Button/ Axis |
Interaction Type | UNIGINE Button/ Axis |
UNIGINE Axis Number | Axis Range |
---|---|---|---|---|
|
Press |
|
||
|
Press |
|
||
|
Press / Touch |
|
||
|
Horizontal / Vertical Movement |
|
[-1;1]
|
|
|
Press / Touch |
|
||
|
Squeeze | 2 for the Trigger axis | [0;1] | |
|
Squeeze |
|
Valve Knuckles Controller Inputs阀节控制器输入#
Button/ Axis |
Interaction Type | UNIGINE Button/ Axis |
UNIGINE Axis Number | Axis Range |
---|---|---|---|---|
A Button | Press |
|
||
B Button | Press |
|
||
System Button | Press |
|
||
Trigger | Press / Touch |
|
||
Trigger | Squeeze | 2 for the Trigger axis | [0;1] | |
Track Button (Trackpad) | Press / Touch |
|
||
Track Button (Trackpad) | Horizontal / Vertical Movement |
|
[-1;1]
|
|
Thumbstick | Press / Touch |
|
||
Thumbstick | Horizontal / Vertical Movement |
|
[-1;1]
|
|
Grip | Press / Touch |
|
Head-Mounted Displays头盔显示装置#
The VR system allows you to process input from head-mounted displays (HMDs) via the InputVRHead class.VR系统允许您通过InputVRHead类处理来自头戴式显示器 (HMDs)的输入。
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. VR基站帮助HMD和控制器跟踪他们的准确位置,增强房间级虚拟现实体验的沉浸感。
The InputVRDevice and InputVRBaseStation classes is used to handle base station input.InputVRDevice和InputVRBaseStation类用于处理基站输入。
VR TrackersVR追踪器#
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. VR跟踪器允许将真实世界的物体嵌入VR环境中。你可以把它附在需要追踪的实物上。在混合现实中,你可以在相机或播放器上安装VR跟踪器,以跟踪其在虚拟世界中的位置。
The InputVRDevice and InputVRTracker classes is used to manage tracker input.InputVRDevice和InputVRTracker类用于管理跟踪器输入。