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

Unigine::Plugins::Oculus Class

Header: #include <plugins/Unigine/Oculus/UnigineOculus.h>

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

Notice
For more detailed information on application development with the Oculus Rift support, check also the following:

See also#

Oculus Class

枚举

AXIS#

Name描述
AXIS_INDEX_TRIGGER = 0Left and right finger trigger values, in the range 0.0 to 1.0f. A value of 1.0 means that the trigger is fully depressed.
AXIS_HAND_TRIGGER = 1Left and right hand trigger values, in the range 0.0 to 1.0f. Hand trigger is often used to grab items. A value of 1.0 means that the trigger is fully depressed.
AXIS_THUMBSTICK = 2Horizontal and vertical thumbstick axis values, in the range -1.0f to 1.0f. The API automatically applies the deadzone, so developers don’t need to handle it explicitly.
AXIS_INDEX_TRIGGER_NO_DEADZONE = 3Left and right finger trigger values, in the range 0.0 to 1.0f, without a deadzone. A value of 1.0 means that the trigger is fully depressed.
AXIS_HAND_TRIGGER_NO_DEADZONE = 4Left and right hand trigger values, in the range 0.0 to 1.0f, without a deadzone. Hand trigger is often used to grab items. A value of 1.0 means that the trigger is fully depressed.
AXIS_THUMBSTICK_NO_DEADZONE = 5Horizontal and vertical thumbstick axis values, in the range -1.0f to 1.0f, without a deadzone.

TOUCH#

Name描述
TOUCH_A = 1User is touching A button on the right controller.
TOUCH_B = 2User is touching B button on the right controller.
TOUCH_RTHUMB = 4User has a finger on the thumb stick of the right controller.
TOUCH_RTHUMB_REST = 8User has a finger on the textured thumb rest of the right controller.
TOUCH_RINDEX_TRIGGER = 16User is touching the index finger trigger on the right controller.
TOUCH_RINDEX_POINTING = 32User's right index finger is pointing forward past the trigger.
TOUCH_RTHUMB_UP = 64User's right thumb is up and away from buttons on the controller, a gesture that can be interpreted as right thumbs up.
TOUCH_X = 256User is touching X button on the left controller.
TOUCH_Y = 512User is touching Y button on the left controller.
TOUCH_LTHUMB = 1024User has a finger on the thumb stick of the left controller.
TOUCH_LTHUMB_REST = 2048User has a finger on the textured thumb rest of the left controller.
TOUCH_LINDEX_TRIGGER = 4096User is touching the index finger trigger on the left controller.
TOUCH_LINDEX_POINTING = 8192User's left index finger is pointing forward past the trigger.
TOUCH_LTHUMB_UP = 16384User's left thumb is up and away from buttons on the controller, a gesture that can be interpreted as left thumbs up.

BUTTON#

Name描述
BUTTON_A = 1A button on the right Touch controller.
BUTTON_B = 2B button on the right Touch controller.
BUTTON_RTHUMB = 4Thumb stick button on the right Touch controller.
BUTTON_RSHOULDER = 8Shoulder button on the right Touch controller.
BUTTON_X = 256X button on the left Touch controller.
BUTTON_Y = 512Y button on the left Touch controller.
BUTTON_LTHUMB = 1024Thumb stick button on the left Touch controller.
BUTTON_LSHOULDER = 2048Shoulder button on the left Touch controller.
BUTTON_UP = 65536The Up button on the remote controller.
BUTTON_DOWN = 131072The Down button on the remote controller.
BUTTON_LEFT = 262144The Left button on the remote controller.
BUTTON_RIGHT = 524288The Right button on the remote controller.
BUTTON_ENTER = 1048576Enter button on the left Touch controller. This is equivalent to the Start button on the Xbox controller.
BUTTON_BACK = 2097152The Back button on the remote controller.
BUTTON_VOLUP = 4194304The Volup button on the remote controller.
BUTTON_VOLDOWN = 8388608The Voldown button on the remote controller.
BUTTON_HOME = 16777216The Home button on the remote controller.

DEVICE#

Name描述
DEVICE_HMD = 0Oculus head-mounted display.
DEVICE_CONTROLLER_LEFT = 1Left controller.
DEVICE_CONTROLLER_RIGHT = 2Right controller.

VIEWPORT#

Name描述
VIEWPORT_BLACK_SCREEN = 0No image (black screen).
VIEWPORT_MONO = 1Mono image.
VIEWPORT_STEREO = 2Stereo image (left and right eye).
VIEWPORT_STEREO_FINAL = 3Stereoscopic spherical image.

Members


Math::vec2 getControllerAxis ( Oculus::DEVICE device, Oculus::AXIS 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).

bool getControllerButtonPressed ( Oculus::BUTTON button ) #

Returns the value indicating if the specified button is pressed.

Arguments

Return value

true if the button is pressed; otherwise - false.

bool getControllerButtonTouched ( Oculus::TOUCH button ) #

Returns the value indicating if the specified button is touched.

Arguments

Return value

true if the button is touched; otherwise - false.

void setControllerVibration ( Oculus::DEVICE device, unsigned short duration, float amplitude ) #

Sets the vibration of the given duration and amplitude.

Arguments

  • Oculus::DEVICE device - Device ID, one of the DEVICE variables.
  • unsigned short duration - Duration of the vibration.
  • float amplitude - Amplitude of the vibration.

Math::vec3 getDeviceAngularVelocity ( Oculus::DEVICE device ) #

Returns a device angular velocity, in radians per second.

Arguments

Return value

Angular velocity.

bool isDeviceConnected ( Oculus::DEVICE device ) #

Returns a value indicating if the device connected to the slot.

Arguments

Return value

true - connected; false - not connected.

Math::mat4 getDevicePose ( Oculus::DEVICE device ) #

Returns a single pose for a tracked device.

Arguments

Return value

Identity matrix.

Math::vec3 getDeviceVelocity ( Oculus::DEVICE device ) #

Returns a device velocity in tracker space, in meters per second.

Arguments

Return value

Velocity.

void setEnabled ( bool enabled ) #

Toggles the VR mode.

Arguments

  • bool enabled - true to enable the VR mode; false to disable it.

bool isEnabled ( ) const#

Returns the value indicating if the VR mode is enabled or not.

Return value

true if the VR mode is enabled; false if it is disabled.

void setHeadPositionLock ( bool lock ) #

Locks the head position.

Arguments

  • bool lock - true to lock the head position.

bool isHeadPositionLock ( ) const#

Returns the value indicating if the head position is locked.

Return value

true if the head position is locked; otherwise - false.

void setHeadRotationLock ( bool lock ) #

Locks the head rotation.

Arguments

  • bool lock - true to lock the head rotation.

bool isHeadRotationLock ( ) const#

Returns the value indicating if the head rotation is locked.

Return value

true if the head rotation is locked; otherwise - false.

bool isPoseValid ( Oculus::DEVICE device ) #

Returns a value indicating if the device pose is valid.

Arguments

Return value

true - valid; false - invalid.

void setPositionScale ( float scale ) #

Sets a new scale for the world. When increasing the scale, the objects get smaller when they are farther away.

Arguments

  • float scale - World scale.

float getPositionScale ( ) const#

Returns the current world scale. When increasing the scale, the objects get smaller when they are farther away.

Return value

World scale.

Oculus::VIEWPORT getViewportMode ( ) const#

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 VIEWPORT variables.

void setViewportMode ( Oculus::VIEWPORT mode ) #

Sets the viewport mode, that world scales the type of image to be displayed in the viewport.

Arguments

const char * getVersion ( ) const#

Returns the libOVRT version of the HMD.

Return value

The libOVR version (a UTF-8 encoded null-terminated version string).

int getHmdType ( ) const#

Returns the OpenVR type of the HMD.

Return value

HMD type.

const char * getHmdProductName ( ) const#

Returns the name of the HMD (UTF-8 encoded product identification string).

Return value

Device name.

const char * getHmdManufacturer ( ) const#

Returns the name of the HMD manufacturer (UTF-8 encoded identification string).

Return value

Manufacturer name.

int getHmdVendorID ( ) const#

Returns the HID (USB) vendor identifier of the HMD.

Return value

Vendor ID.

int getHmdProductID ( ) const#

Returns the HID (USB) product identifier of the HMD.

Return value

HID product identifier.

int getHmdFirmwareMajor ( ) const#

Returns the major version of the HMD firmware.

Return value

Major version of the device firmware.

int getHmdFirmwareMinor ( ) const#

Returns the minor version of the HMD firmware.

Return value

Minor version of the device firmware.

float getHmdTrackerHFov ( ) const#

Returns the horizontal FOV (if present) of the tracking sensor frustum in degrees.

Return value

Horizontal FOV of the tracking sensor frustum in degrees.

float getHmdTrackerVFov ( ) const#

Returns the vertical FOV (if present) of the tracking sensor frustum in degrees.

Return value

Vertical FOV of the tracking sensor frustum in degrees.

float getHmdTrackerZNear ( ) const#

Returns the distance from the tracking sensor to the near Z clipping plane of viewing frustum.. The returned value was already multiplied by the current world scale.

Return value

Distance from the tracking sensor to the tracking frustum near Z in meters.

float getHmdTrackerZFar ( ) const#

Returns the distance from the tracking sensor to the far Z clipping plane of viewing frustum.. The returned value was already multiplied by the current world scale.

Return value

Distance from the tracking sensor to the tracking frustum far Z in meters.

int getDefaultHmdCaps ( ) const#

Returns HMD capability bits that are default for the current device.

Return value

Default HMD capability bits.

int getDefaultTrackingCaps ( ) const#

Returns tracking capability bits that are default for the current system.

Return value

Default tracking capability bits.

int getAvailableHmdCaps ( ) const#

Returns HMD capability bits that the device currently supports.

Return value

HMD capability bits.

int getAvailableTrackingCaps ( ) const#

Returns tracking capability bits that the system currently supports.

Return value

Tracking capability bits.

Math::vec4 getHmdDefaultFov ( int num ) const#

Returns the default optical field of view for the specified eye.

Arguments

  • int num - Eye: 0 for the left eye, 1 for the right eye.

Return value

Default field of view.

Math::vec4 getHmdMaxFov ( int num ) const#

Returns the maximum optical field of view that can be practically rendered for the specified eye.

Arguments

  • int num - Eye: 0 for the left eye, 1 for the right eye.

Return value

Maximum field of view.

int getHmdWidth ( ) const#

Returns the horizontal resolution of the full HMD screen (both eyes) in pixels.

Return value

Horizontal resolution in pixels.

int getHmdHeight ( ) const#

Returns the vertical resolution of the full HMD screen (both eyes) in pixels.

Return value

Vertical resolution in pixels.

const char * getHmdSerialNumber ( ) const#

Returns the serial number of the HMD.

Return value

HMD Serial number.

void resetTracking ( ) #

Re-centers the sensor position and orientation: the (x,y,z) positional components and the yaw component of orientation. The roll and pitch components are always determined by gravity and cannot be redefined. See also ovr_RecenterTrackingOrigin method in the OVR_CAPI.h file reference.

Math::vec4 getEyeFov ( int num ) const#

Returns the current field of view of the given eye.

Arguments

  • int num - Eye: 0 for the left eye, 1 for the right eye.

Return value

Eye field of view.

Math::vec3 getEyePosition ( int num ) const#

Returns the current position of the given eye. The returned value was already multiplied by the current world scale.

Arguments

  • int num - Eye: 0 for the left eye, 1 for the right eye.

Return value

The eye position.

Math::quat getEyeRotation ( int num ) const#

Returns the current orientation of the given eye.

Arguments

  • int num - Eye: 0 for the left eye, 1 for the right eye.

Return value

The eye orientation.

Math::vec3 getHeadPosition ( ) const#

Returns the current position of the head. The returned value was already multiplied by the current world scale.

Return value

Position of the head.

Math::quat getHeadRotation ( ) const#

Returns the current orientation of the head.

Return value

Orientation of the head.

Math::vec3 getHeadLinearVelocity ( ) const#

Returns the current linear velocity of the head.

Return value

Linear velocity of the head in meters per second.

Math::vec3 getHeadAngularVelocity ( ) const#

Returns the current angular velocity of the head.

Return value

Angular velocity of the head in radians per second.

Math::vec3 getHeadLinearAcceleration ( ) const#

Returns the current linear acceleration of the head.

Return value

Linear acceleration of the head in meters per second squared.

Math::vec3 getHeadAngularAcceleration ( ) const#

Returns the current angular acceleration of the head.

Return value

Angular acceleration of the head in radians per second squared.

Math::vec3 getHandPosition ( int num ) const#

Returns the current position of the given hand. The returned value was already multiplied by the current world scale.

Arguments

  • int num - Hand: 0 for the left hand, 1 for the right hand.

Math::quat getHandRotation ( int num ) const#

Returns the current orientation of the given hand.

Arguments

  • int num - Hand: 0 for the left hand, 1 for the right hand.

Math::vec3 getTrackerPosition ( ) const#

Returns the current position of the sensor relative to the tracking origin. The returned value was already multiplied by the current world scale.

Return value

Position of the sensor relative to the tracking origin.

Math::quat getTrackerRotation ( ) const#

Returns the current orientation (sensor roll and pitch) of the sensor relative to the tracking origin.

Return value

Orientation (roll and pitch) of the sensor relative to the tracking origin.

Math::vec3 getLeveledTrackerPosition ( ) const#

Returns the current position of the leveled sensor (aligned with gravity) relative to the tracking origin. The returned value was already multiplied by the current world scale.

Return value

Position of the leveled sensor relative to the tracking origin.

Math::quat getLeveledTrackerRotation ( ) const#

Returns the current orientation (only sensor yaw, not roll and pitch) of the leveled sensor (aligned with gravity) relative to the tracking origin.

Return value

Orientation (yaw) of the sensor relative to the tracking origin.

unsigned int getTrackingStatus ( ) const#

Returns the current status of the sensor tracking.

Return value

Status of the sensor tracking.

bool isVisible ( ) const#

Returns a value indicating if the process has VR focus and thus is visible in HMD.

Return value

true if the information about the HMD session status is visible; otherwise, false.

void render ( const Ptr<Player> & player, const Math::ivec2 & size, bool render_window ) #

Arguments

Last update: 2024-12-13
Build: ()