This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Режимы вывода изображения
Физика
Браузер SDK 2
Лицензирование и типы лицензий
Дополнения (Add-Ons)
Демонстрационные проекты
API Samples
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
Унифицированный язык шейдеров UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
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
Учебные материалы

Unigine.InputVRController Class

Inherits from: InputVRDevice

The class manages VR controller input, serving as the primary interface for VR input.

Notice
Each instance of the InputVRController class will contain its own set of values sampled from the controller.

There are three types of VR controllers: left-hand, right-hand controllers, and a treadmill. To get the type of the VR controller, you can use the getControllerType() function.

The class provides access to the following input:

  • Buttons of the VR controller, including the touch buttons. They can be either pressed or released in the current frame or continuously pressed or touched for multiple frames in a row, including the current one.
  • Axes of the VR controller that detect 1-dimensional movement of the control. Depending on the type of the VR controller, there can be a different number of axes. Usually, there are 3 or 4 axes.

    An axis can be mapped to a control of one of the supported types, also referred to as an axis type.

    To identify the supported axes, call getNumAxes(). Additionally, you can get the axis type using getAxisType(), find the axis index by its type via findAxisByType(), or get a state value for the axis via getAxisByType().

Notice
The article on VR Input System provides several examples of inputs on different types of OpenVR-supported controllers and information on buttons and axes mapping in UNIGINE.

InputVRController Class

Перечисления (Enums)

MODEL_TYPE#

ИмяОписание
UNKNOWN = 0Unknown controller.
HTC_VIVE = 1HTC Vive
OCULUS_RIFT = 2Oculus Rift
VALVE_KNUCKLES = 3Valve Index Knuckles
NUM_MODEL_TYPES = 4Total number of VR controller models.

CONTROLLER_TYPE#

ИмяОписание
UNKNOWN = 0Unknown controller type
HAND_LEFT = 1Left hand controller
HAND_RIGHT = 2Right hand controller
TREADMILL = 3Treadmill
NUM_CONTROLLER_TYPES = 4Total number of controller types

AXIS_TYPE#

ИмяОписание
NONE = 0Not specified
TRACKPAD_X = 1Trackpad X-axis. The axis range is [-1;1].
TRACKPAD_Y = 2Trackpad Y-axis. The axis range is [-1;1].
TRACKPAD_FORCE = 3Trackpad axis that takes into account the force value of the finger pressure. The axis range is [0;1].
JOYSTICK_X = 4Joystick X-axis. The axis range is [-1;1].
JOYSTICK_Y = 5Joystick Y-axis. The axis range is [-1;1].
JOYSTICK_FORCE = 6Joystick axis that takes into account the force value of the finger pressure. The axis range is [0;1].
GRIP_VALUE = 7Grip axis taking the value from 0 to 1.
GRIP_FORCE = 8Grip axis that takes into account the force value of the finger pressure exceeding 1.
TRIGGER_VALUE = 9Trigger axis taking the value from 0 to 1.
TRIGGER_FORCE = 10Trigger axis that takes into account the force value of the finger pressure exceeding 1.
TRIGGER_CURL_VALUE = 11Trigger curl axis taking the value from 0 to 1.
TRIGGER_CURL_FORCE = 12Trigger curl axis that takes into account the force value of the finger pressure exceeding 1.
TRIGGER_SLIDE_VALUE = 13Trigger slide axis taking the value from 0 to 1.
TRIGGER_SLIDE_FORCE = 14Trigger slide axis that takes into account the force value of the finger pressure exceeding 1.
PINCH_VALUE = 151D analog input component indicating the extent which the user is bringing their finger and thumb together to perform a pinch gesture (supported by WMR).
GRASP_VALUE = 161D analog input component indicating that the user is making a fist (supported by WMR).
AIM_ACTIVATE_VALUE = 171D analog input component indicating that the user activated the action on the target that the user is pointing at with the aim pose (supported by WMR).
NUM_AXIS_TYPES = 18Total number of axis types.

Properties

InputVRController.MODEL_TYPE ModelType#

The model type of the VR controller.

float Filter#

The filter value used to correct the current state of the analog axis relative to the previous one. Axis states are interpolated for thumbsticks and triggers.

InputVRController.CONTROLLER_TYPE ControllerType#

The the type of the VR controller.

int NumAxes#

The number of axes supported by the VR controller.

ulong SupportedButtonsMask#

The supported buttons for the controller.

bool IsUsingHandTracking#

The value indicating if the controller uses hand tracking, i.e. hands don't hold controllers and their movements can be tracked.
Notice
For OpenXR devices.

Members


InputVRController.AXIS_TYPE GetAxisType ( int axis ) #

Returns the type of the specified axis.

Arguments

  • int axis - Axis number.

Return value

Axis type.

float GetAxis ( int axis ) #

Returns a state value for the specified axis. It includes position of the VR controller along the following axes: X, Y (two-axis controller) and Z (three-axis controller). When the VR controller is in the center position, X and Y axes values are zero. Negative values indicate left or down; positive values indicate right or up.

Arguments

  • int axis - Axis number.

Return value

Value in range [-1.0f; 1.0f].

float GetAxisDelta ( int axis ) #

Returns the axis delta — the difference between a new and the current state of the specified axis.

Arguments

  • int axis - Axis number.

Return value

Value in range [-1.0f; 1.0f].

bool IsButtonPressed ( Input.VR_BUTTON button ) #

Returns a value indicating if the specified button is pressed. Check this value to perform continuous actions.

Arguments

Return value

true if the button is pressed; otherwise, false.

bool IsButtonDown ( Input.VR_BUTTON button ) #

Returns a value indicating if the specified button was pressed during the current frame.

Arguments

Return value

true if the button was pressed; otherwise, false.

bool IsButtonUp ( Input.VR_BUTTON button ) #

Returns a value indicating if the specified button was released during the current frame.

Arguments

Return value

true if the button was released; otherwise, false.

bool IsButtonTouchPressed ( Input.VR_BUTTON touch ) #

Returns a value indicating if the specified button is touched.

Arguments

Return value

true if the button is touched; otherwise, false.

bool IsButtonTouchDown ( Input.VR_BUTTON touch ) #

Returns a value indicating if the specified touch button was "pressed" in the currect frame.

Arguments

Return value

true if the touch button was "pressed"; otherwise, false.

bool IsButtonTouchUp ( Input.VR_BUTTON touch ) #

Returns a value indicating if the specified touch button was "released" in the currect frame.

Arguments

Return value

true if the touch button was "released"; otherwise, false.

InputEventVRButton GetButtonEvent ( Input.VR_BUTTON button ) #

Returns the currently processed VR controller button input event.

Arguments

Return value

VR controller button input event, or null if there are no events for the specified button in the current frame.

int GetButtonEvents ( Input.VR_BUTTON button, InputEventVRButton[] OUT_events ) #

Returns the number of input events for the specified VR controller button and puts the events to the specified output buffer.

Arguments

  • Input.VR_BUTTON button - Button.
  • InputEventVRButton[] OUT_events - Buffer with button input events.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.

Return value

Number of input events for the specified VR controller button.

InputEventVRButtonTouch GetButtonTouchEvent ( Input.VR_BUTTON button ) #

Returns the currently processed VR controller button touch event.

Arguments

Return value

VR controller button touch event, or null if there are no events for the specified touch button in the current frame.

int GetButtonTouchEvents ( Input.VR_BUTTON button, InputEventVRButtonTouch[] OUT_events ) #

Returns the number of touch events for the specified VR controller touch button and puts the events to the specified output buffer.

Arguments

  • Input.VR_BUTTON button - Button.
  • InputEventVRButtonTouch[] OUT_events - Buffer with button touch events.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.

Return value

Number of input events for the specified VR controller touch button.

void StopHaptic ( ) #

Stops the vibration feedback.

void ApplyHaptic ( float amplitude = -1, double duration_ms = -1, float frequency_hz = -1 ) #

Applies the vibration feedback with the specified amplitude, duration and frequency parameters.

Arguments

  • float amplitude - Amplitude of vibration between 0.0 and 1.0.
  • double duration_ms - Duration of the vibration, in milliseconds.
  • float frequency_hz - Frequency of the vibration in Hz.

float GetAxisByType ( InputVRController.AXIS_TYPE axis_type ) #

Returns a state value for the axis of the specified type. It includes position of the VR controller along the X and Y axes (a two-axis controller). The return value depends on the axis type.

Arguments

Return value

Value in range [-1.0f;1.0f].

int FindAxisByType ( InputVRController.AXIS_TYPE axis_type ) #

Returns the index of the axis by its type.

Arguments

Return value

Axis index.
Last update: 13.12.2024
Build: ()