This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 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版本。

虚拟现实输入系统

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插件 (OpenVR, Varjo, Oculus)被认为已弃用,将在下一个SDK版本中删除。

VR Controllers
VR控制器#

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, VarjoOculus设备。在本文中,我们将考虑以下控制器模型作为示例:

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

    注意
    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().
    Axes检测控件的一维运动,并具有更复杂的行为。

    根据VR控制器的类型不同,轴的数量也不同。UNIGINE最多支持 4轴。但通常,控制器有3

    在 UNIGINE 中,轴可以映射到以下类型之一的控件(也称为轴类型):trackpadjoystick,或触发。 每种轴类型都有不同数量的保留轴。 例如,组合操纵杆或触控板的两个轴可以跟踪沿 X 轴和 Y 轴的二维运动。

    注意
    您无法提前知道连接的是哪种类型的控制器,因此 UNIGINE API 允许您识别支持的轴数量并检查它们的类型

Inputs for OpenVR Controllers
OpenVR控制器#

本章展示了不同类型的openvr支持的控制器上的输入示例- HTC Vive, Oculus TouchValve Knuckles控制器-并提供了这些输入如何映射到UNIGINE输入系统中的按钮和轴的信息。

注意
You can find the list of common OpenVR controller types here.您可以在这里找到常见的OpenVR控制器类型列表

HTC Vive Controller Inputs
HTC Vive控制器输入#

注意
This type of controller is supported by Varjo devices as well.Varjo设备也支持这种类型的控制器。

HTC Vive Controller Axes and Buttons (image sourced from vive.com, courtesy of vive.com)HTC Vive控制器轴和按钮(图片来源: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
Oculus Touch Controller输入#

注意
This type of controller works via OpenVR and is compatible with Oculus HMDs only.这种类型的控制器通过OpenVR工作,仅与Oculus hmd兼容。

Oculus Touch Controller Axes and Buttons (image courtesy of developer.oculus.com)Oculus触控控制器轴和按钮(图片来源: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
阀节控制器输入#

注意
This type of controller is supported by Varjo devices as well.Varjo设备也支持这种类型的控制器。

Valve Knuckles controller axes and buttons (Image sourced from steamcommunity.com, courtesy of steamcommunity.com)阀节控制器轴和按钮(图片来自steamcommunity.com,由steamcommunity.com提供)
注意
Currently, UNIGINE doesn't offer support for the Force Sensor and Finger Tracking inputs.目前,UNIGINE不支持Force SensorFinger Tracking输入。
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.VR系统允许您通过InputVRHead类处理来自头戴式显示器 (HMDs)的输入。

注意
The InputVRDevice class is also used for managing HMD input.0_php类也用于管理HMD输入。

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.InputVRDeviceInputVRBaseStation类用于处理基站输入。

VR Trackers
VR追踪器#

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.InputVRDeviceInputVRTracker类用于管理跟踪器输入。

最新更新: 2024-08-16
Build: ()